Skip to content

Instantly share code, notes, and snippets.

@fedosov
Created April 13, 2013 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedosov/266beba8be170c4bf0f3 to your computer and use it in GitHub Desktop.
Save fedosov/266beba8be170c4bf0f3 to your computer and use it in GitHub Desktop.
<?php
$url = "http://maps.google.com/maps/api/geocode/json?sensor=false&address=New+York";
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $url);
$contents = curl_exec($c);
curl_close($c);
$resp = json_decode($contents, true);
$location = $resp['results'][0]['geometry']['location'];
echo $location['lat'], $location['lng'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment