【发布时间】:2013-05-08 23:45:14
【问题描述】:
我必须仅从带有我指定坐标的 xml 数据中获取方向信息。这是我的代码
<?php
$string= simplexml_load_file("http://maps.googleapis.com/maps/api/directions/xml?origin=37.036543,35.288086&destination=36.997415,35.288067&sensor=false");
print_r ($string);
$xml = new SimpleXMLElement($string);
$result = $xml->xpath('/WebServiceRequest/result[2]/message/text()');
while(list( , $node) = each($result)) {
echo 'b/c: ',$node,"\n";
}
?>
但我收到以下错误: 警告:SimpleXMLElement::__construct() [simplexmlelement.--construct]:实体:第 4 行:解析器错误:需要开始标记,在
中找不到“当然还有其他错误。【问题讨论】:
标签: php xml google-maps-api-3