dqyp50298 2014-12-14 15:45
浏览 54
已采纳

使用PHP从外部XML文件获取数据

I am using this code so far but its not working for me:

<?php
$url = 'http://maps.googleapis.com/maps/api/geocode/xml?address=Mumbai';
$xml = simplexml_load_file($url);

$lat=$xml->lat;
echo "Latitude:".$lat;
echo '<br/>';
$lng=$xml->lng;
echo "Longitude:".$lng;
echo '<br/>';
?>

I tried other questions as well in this site but didn't got any luck. Any help would be greatly appreciated.

  • 写回答

1条回答 默认 最新

  • dpqmu84646 2014-12-14 17:12
    关注
    $xml->result->geometry->location->lat
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?