Skip to content

Instantly share code, notes, and snippets.

@sangar82
Created April 23, 2013 09:19
Show Gist options
  • Save sangar82/5442092 to your computer and use it in GitHub Desktop.
Save sangar82/5442092 to your computer and use it in GitHub Desktop.
Get lat,lng from googleapis from PHP
$direccion = "put here the adress";
$resultado = json_decode(file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address=".urlencode($direccion)."&sensor=false"));
echo $resultado->results["0"]->geometry->location->lat;
echo $resultado->results["0"]->geometry->location->lng;
@xeoncross
Copy link

Notice there may be more than one result (or none at all).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment