user3392296
user3392296

Reputation: 644

Google Geocoding is only running without API Key

I'm running Geocoding with that code, what works perfect: $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . $address . '&sensor=false';

Problem is, it only runs with a few addresses (about 200) and then it stopps and so I have to wait 24hours to start geocoding again.

So I have created an API Key to geocode 2500 addresses a day and add it like this: $url = http://maps.googleapis.com/maps/api/geocode/json?&address= . $address . &sensor=false&key=MY_API_KEY;

Problem now is, nothing happens. No address is getting geocoded. Only without an API key it works for a few addresses. I also tried different keys, with an specific referrer and without and referrer - nothing changes. Not only one address is getting geocoded.

Thanks afor help!

Upvotes: 1

Views: 2315

Answers (1)

geocodezip
geocodezip

Reputation: 161334

Look at the error message that is returned when you call the API with a key:

http://maps.googleapis.com/maps/api/geocode/json?&address=New%20York,NY&sensor=false&key=my_api_key

{
   "error_message" : "Requests to this API must be over SSL.",
   "results" : [],
   "status" : "REQUEST_DENIED"
}

You need to use the https: protocol.

https://maps.googleapis.com/maps/api/geocode/json?&address=New%20York,NY&sensor=false&key=my_api_key

{
   "error_message" : "The provided API key is invalid.",
   "results" : [],
   "status" : "REQUEST_DENIED"
}

Upvotes: 6

Related Questions