【发布时间】:2016-09-21 06:17:55
【问题描述】:
Geocode API 每天允许 2500 个请求,但我的网站没有在一天内发送此类请求。我的代码是否发送自动请求?
function getmap($addrss,$location,$city){
$address = $addrss.' '.$city.' '.$location;
$prepAddr = urlencode($address);
$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false');
$output= json_decode($geocode);
$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;
$retval = $lat.'*'.$long;
return $retval;
}
响应来了
[error_message] => 您已超出此 API 的每日请求配额.....[status] => OVER_QUERY_LIMIT )
请提供任何建议。
【问题讨论】:
-
要知道您的代码是否发送自动请求,您需要知道什么调用了
getmap()函数。 -
它是一个简单的从首页调用一次的函数,它没有在任何循环中。
-
您使用的是共享主机吗?其他人可能也在使用 Geocoding API。
-
没有完全专用的服务器。我的代码正确吗?
-
OVER_QUERY_LIMIT是由于超过了每秒的最大请求,在每个请求后使用 100 或 200 毫秒的 setTimeout..
标签: php json google-maps google-maps-api-3 latitude-longitude