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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥15 DruidDataSource一直closing
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据