GMaps api Geocode奇怪的行为

Kak*_*ait 2 php xml google-maps

我正在使用gmaps apiv3 webservice与latlng couple进行地理编码.这很简单,但我对某些数据有一种奇怪的行为.

公式:

http://maps.googleapis.com/maps/api/geocode/xml?sensor=false®ion=fr&latlng=46.16141,-1.149797

接下来我用导航器(firefox/chrome)打开url,并在行中formatted_address输入值为:

<formatted_address>57-79 Rue des Merciers, 17000 La Rochelle, France</formatted_address>
Run Code Online (Sandbox Code Playgroud)

但是当我通过PHP获取xml文件时

$xml = simplexml_load_file($url);
var_dump($xml)
Run Code Online (Sandbox Code Playgroud)

结果:

public 'formatted_address' => string '57-79 Rue des Merciers, 17000 Rochelle, France' (length=46)
Run Code Online (Sandbox Code Playgroud)

在'罗谢尔'之前的'La'这个词刚刚消失......那是我的问题.而且这不是一个独特的案例(我可以发布更多例子).

我也尝试用file_get_contents, curl, wget...相同的结果

Pek*_*ica 6

这是因为格式化的街道地址是区域设置感知的accept-language,并且可能对您的浏览器标题作出反应fr-FR.

如果您要在伦敦编码一个职位,您可以Londres使用法语浏览器,London英语浏览器,芬兰语浏览器Lontoo等.

使用该language参数强制语言.

http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&
region=fr&latlng=46.16141,-1.149797&language=fr
Run Code Online (Sandbox Code Playgroud)