0

I have a script in PHP to get Latitude and Longitude of an address. I never used an API KEY, but the code always worked. Weeks ago, it stopped to work So, I get an API Key. However, isn't working.

Follow a part of the script:

function loadURL($url){
    if (function_exists('curl_init')) {
       $cURL = curl_init($url);
       curl_setopt($cURL, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($cURL, CURLOPT_FOLLOWLOCATION, true);
       $result = curl_exec($cURL);
       curl_close($cURL);
    } else {
       $result = file_get_contents($url);
    }    
    if (!$result) 
       return false;        
    return $result;        
}

I did a test with another example: 1600 Amphitheatre Parkway, Mountain View, CA

The same example that Google uses.

Here is the url:
http://maps.googleapis.com/maps/geo?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&output=csv&sensor=true_or_false&key=your_api_key

I put my API key, set true or false to sensor, but the result is:

Status: 610 (**G_GEO_BAD_KEY**)

Why?

Kara
  • 6,115
  • 16
  • 50
  • 57

1 Answers1

2

You are using the v2 version of the geocoder. The v2 geocoder only works with v2 keys which are no longer available (reference: this post in the Google Maps API v2 group)

If you have a v2 key use that. If not, get a v3 key and transition to the v3 Geocoding web service.

geocodezip
  • 158,664
  • 13
  • 220
  • 245