Created
January 14, 2012 10:20
-
-
Save dodyw/1610906 to your computer and use it in GitHub Desktop.
geocode with google api v3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$address = "Sutorejo Utara, Surabaya, Indonesia"; | |
$address = urlencode($address); | |
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$address&sensor=false"; | |
$raw = file_get_contents($url); | |
$data = json_decode($raw); | |
$lat = $data->results[0]->geometry->location->lat; | |
$lng = $data->results[0]->geometry->location->lng; | |
print $lat. ", ".$lng; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment