【发布时间】:2013-02-08 22:38:51
【问题描述】:
我了解 Google 将请求限制为每天 2,500 次...但在 EARTH 上我无法发出这么多请求,我只是不断收到“OVER_QUERY_LIMIT”
$street_no = get_post_meta($prop->ID, 'street_no', true);
$street = get_post_meta($prop->ID, 'street', true);
$street_suffix = get_post_meta($prop->ID, 'street_suffix', true);
$addr = urlencode( $street_no." ".$street." ".$street_suffix." BC Canada" );
$url = 'http://maps.googleapis.com/maps/api/geocode/json?address='.$addr.'&sensor=true';
$json_result = json_decode(file_get_contents($url));
if ( $json_result->status === "OVER_QUERY_LIMIT" ) :
sleep(2);
$json_result = json_decode(file_get_contents($url));
endif;
如您所见,如果我得到OVER_QUERY_LIMIT 的状态,我会告诉脚本休眠 2 秒,然后继续……这似乎在今天早上的某个时间点起作用,但现在我不能甚至对单个地址进行地理编码。
我现在不知道该怎么办......这让我的应用程序完全没用。
【问题讨论】:
-
请求来自哪里?你的服务器?你的桌面?你的手机?您在 rackspace.com 上的共享主机?
-
请求是从机架空间上的云站点发出的,是的。其中,当我开始输入此内容时,可能在同一 IP 上可能有其他人正在查询地理编码 api。
标签: php google-maps geolocation geocoding