【发布时间】:2015-03-16 08:16:57
【问题描述】:
我正在尝试使用 PHP 执行 Google 地理编码请求,但我得到了 403 Forbidden 答案:
警告:file_get_contents(http://maps.google.com/maps/api/geocode/json?address=Bahnhofstrasse+1,+Zurich&sensor=false):打开流失败:HTTP 请求失败! HTTP/1.0 403 Forbidden in ...
在不同的服务器上使用相同的代码,请求可以工作。谷歌是否有可能阻止我来自特定服务器的请求?请求太多?
这是我的代码:
error_reporting(E_ALL ^ E_NOTICE);
$request = file_get_contents("http://maps.google.com/maps/api/geocode/json?address=Bahnhofstrasse+1,+Zurich&sensor=false");
$json = json_decode($request, true);
print_r($json);
【问题讨论】: