【发布时间】:2012-01-27 20:20:35
【问题描述】:
在我的一个 php 应用程序中,我必须从地址中找出该地点的纬度和经度。
我试过这个代码:
$json = file_get_contents("http://maps.google.com/maps/api/geocode/json?address=$address&sensor=false®ion=$region");
$json = json_decode($json);
$lat = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lat'};
$long = $json->{'results'}[0]->{'geometry'}->{'location'}->{'lng'};
但它显示以下错误:
警告:file_get_contents(http://maps.google.com/maps/api/geocode/json?address=technopark, Trivandrun, kerala,India&sensor=false®ion=IND) [function.file-get-contents]: 失败打开流:HTTP 请求失败!第 4 行 D:\Projects\lon.php 中的 HTTP/1.0 400 错误请求
请帮我解决这个问题。
【问题讨论】:
标签: php google-maps-api-3