Reputation: 11
[SOLVED]
We use the Google Geocoding api. Since few weeks ago it throws an error:
Google Sorry... We're sorry... ... but your computer or network may be sending automated queries. To protect our users, we can't process your request right now.
See Google Help for more information.
I get the longitude and latitude with php.
My url looks like:
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=luzern&sensor=false&key=myGoogleConsoleApiKey";
My php function:
function geturlfile($url) {
$time_start = microtime(true);
$cs = curl_init($url);
curl_setopt($cs, CURLOPT_PORT, 80);
curl_setopt($cs, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($cs, CURLOPT_HEADER, 0);
curl_setopt($cs, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($cs);
$ce = curl_error($cs);
curl_close($cs);
return $result;
}
The result is the error message above!
I tried:
Important facts:
I think google means that we are a bot. How can I tell Google we aren't? Or what is wrong? I hope you can help me!
I forgot to mention that we use the php function in combination with a map. We use it as a store locator: User send a form with a zip or place, we send it to google to get the latitute and longitute and show stores around the address.
Upvotes: 0
Views: 1804
Reputation: 11
[SOLVED]
After several tests I noticed that Google blocked the Server IP or else. I used the code on another server and it worked.
Notice: The server is a shared hosting and I have no chance to change the IP.
Caution irony !! Thank you Google for that and thank you so much for your help !!
So, i found a very nice and good alternative! I changed 3,4 lines of code and BAM it works.
Infos: http://wiki.openstreetmap.org
Geocoding: http://wiki.openstreetmap.org/wiki/Nominatim
Upvotes: 1
Reputation: 2089
Like the Error message from Google clearly states, you performed too many requests in a given time period.
Wait a few hours until Google unblocks your IP or get a new IP address. Nevertheless when needing that many queries to the geocode API, think about caching requests at your local environment or consider "Google Maps API for Work": https://developers.google.com/maps/documentation/geocoding/#Limits
Upvotes: 0