获取 HTTP 403 禁止错误 - Google 使用 PHP 对 API 请求进行地理编码
Getting a HTTP 403 Forbidden Error - Google Geocode API Request with PHP
我正在尝试使用 PHP 执行 Google 地理编码请求,但我收到 403 禁止的答案:
警告:file_get_contents(http://maps.google.com/maps/api/geocode/json?address=Bahnhofstrasse+1,+Zurich&sensor=false):无法打开流:HTTP 请求失败! HTTP/1.0 403 禁止...
在不同的服务器上使用相同的代码请求有效。 google 是否有可能阻止我来自特定服务器的请求?请求太多?
这是我的代码:
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);
是的,您可能在服务器上发送了太多请求。
每个 IP 每天限制 API 个请求。
您可以在 API 网站上查看更多内容。
https://developers.google.com/maps/documentation/business/articles/usage_limits
我正在尝试使用 PHP 执行 Google 地理编码请求,但我收到 403 禁止的答案:
警告:file_get_contents(http://maps.google.com/maps/api/geocode/json?address=Bahnhofstrasse+1,+Zurich&sensor=false):无法打开流:HTTP 请求失败! HTTP/1.0 403 禁止...
在不同的服务器上使用相同的代码请求有效。 google 是否有可能阻止我来自特定服务器的请求?请求太多?
这是我的代码:
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);
是的,您可能在服务器上发送了太多请求。 每个 IP 每天限制 API 个请求。
您可以在 API 网站上查看更多内容。 https://developers.google.com/maps/documentation/business/articles/usage_limits