dqyp50298
dqyp50298
2014-12-14 15:45

使用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 dpqmu84646 7年前
    $xml->result->geometry->location->lat
    
    点赞 评论 复制链接分享