요소에 액세스해야하는 XML 피드가 있습니다. 그러나 내가 시도한 방법 중 어느 것도 효과가 없습니다. 나는이 위도와 LNG 내에서 다음 geometry-> 위치 -> lat-> 위치를 선택하려고 노력하고 있어요PHP의 XML 파일에서 요소를 읽으려면 어떻게해야합니까?
<GeocodeResponse>
<status>OK</status>
<result>
<type>locality</type>
<type>political</type>
<formatted_address>Liverpool, Merseyside, UK</formatted_address>
<address_component>
<long_name>Liverpool</long_name>
<short_name>Liverpool</short_name>
<type>locality</type>
<type>political</type>
</address_component>
<address_component>
<long_name>Merseyside</long_name>
<short_name>Mersyd</short_name>
<type>administrative_area_level_2</type>
<type>political</type>
</address_component>
<address_component>
<long_name>England</long_name>
<short_name>England</short_name>
<type>administrative_area_level_1</type>
<type>political</type>
</address_component>
<address_component>
<long_name>United Kingdom</long_name>
<short_name>GB</short_name>
<type>country</type>
<type>political</type>
</address_component>
<geometry>
<location>
<lat>53.4115400</lat>
<lng>-2.9901160</lng>
</location>
<location_type>APPROXIMATE</location_type>
<viewport>
<southwest>
<lat>53.3049930</lat>
<lng>-3.2462348</lng>
</southwest>
<northeast>
<lat>53.5178208</lat>
<lng>-2.7339972</lng>
</northeast>
</viewport>
<bounds>
<southwest>
<lat>53.3115426</lat>
<lng>-3.0191794</lng>
</southwest>
<northeast>
<lat>53.5039071</lat>
<lng>-2.8115043</lng>
</northeast>
</bounds>
</geometry>
</result>
</GeocodeResponse>
:
다음은 전체의 XML 피드입니다.
을 (http://php.net/manual/en/book.xml.php) –
여기에 PHP 관련 질문이 있습니까? 코드가 있습니까? 파일을 어떻게 읽니? 당신은 아무 것도 효과가 없다고 말하지만, 무엇을 시도 했습니까? –
[PHP에서 XML 파일을 구문 분석하는 방법] 가능한 복제본 (http://stackoverflow.com/questions/1706042/how-to-parse-xml-file-in-php) –