Skip to content

Instantly share code, notes, and snippets.

@dasim
Created February 3, 2011 11:39
Show Gist options
  • Save dasim/809383 to your computer and use it in GitHub Desktop.
Save dasim/809383 to your computer and use it in GitHub Desktop.
Fix is on lines 519 and 520. Variable $this->sensor wasn't converted to string so caused REQUEST_DENIED on direct call of the get_lat_long_from_address() function.
function get_lat_long_from_address($address)
{
$lat = 0;
$lng = 0;
$sensor_str = ($this->sensor) ? 'true' : 'false';
$data_location = "http://maps.google.com/maps/api/geocode/json?address=".str_replace(" ", "+", $address)."&sensor=".$sensor_str;
if ($this->region!="" && strlen($this->region)==2) { $data_location .= "&region=".$this->region; }
$data = file_get_contents($data_location);
$data = json_decode($data);
if ($data->status=="OK") {
$lat = $data->results[0]->geometry->location->lat;
$lng = $data->results[0]->geometry->location->lng;
}
return array($lat, $lng);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment