简体   繁体   English

获取位置的经度和纬度

[英]fetching the latitude and longitude of a location

I am using curl to fetch the latitude and longitude of a particular location. 我正在使用curl来获取特定位置的纬度和经度。 Even upto today morning I got the response properly. 直到今天早上,我都得到了正确的答复。 But now I am getting some status is like "OVER_QUERY_LIMIT". 但是现在我得到一些状态,例如“ OVER_QUERY_LIMIT”。 If I run the same code from a different file then its working. 如果我从不同的文件运行相同的代码,那么它将正常工作。 My code is like: 我的代码是这样的:

$last_url = "http://maps.google.com/maps/api/geocode/json?     address=44+Church+st++Parramatta+2150+Australia&sensor=false";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $last_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
/*curl_setopt($ch, CURLOPT_PROXYPORT, 3128);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);*/
$response = curl_exec($ch);
//echo "++++++++++";
echo $response;
curl_close($ch);

$output = json_decode($response);
echo $lat = $output->results[0]->geometry->location->lat;
echo  $long = $output->results[0]->geometry->location->lng;

Please help me. 请帮我。

The problem is obvious, isn't it? 问题很明显,不是吗? You are limited to a certain number of queries per day. 每天您被限制为一定数量的查询。 There is also a rate limit. 还有一个速率限制。 You went over one of those limits. 您超过了这些限制之一。 If it is working in one script and not the other, you probably hit the rate limit. 如果它在一个脚本中起作用而不在另一个脚本中起作用,则可能达到了速率限制。 Wait a few minutes and try again. 等待几分钟,然后重试。

https://developers.google.com/maps/documentation/geocoding/#Limits https://developers.google.com/maps/documentation/geocoding/#Limits

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM