Forked from madeinnordeste/PHP-Get-Geocode-from-Address
Created
December 27, 2017 19:59
-
-
Save mycarrysun/aed3ef8729d29a4ca9ae8667ad084f0d to your computer and use it in GitHub Desktop.
PHP - Get Geocode (lat, long) from Address
This file contains hidden or 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 = 'avenida+gustavo+paiva,maceio,alagoas,brasil'; | |
$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false'); | |
$output= json_decode($geocode); | |
$lat = $output->results[0]->geometry->location->lat; | |
$long = $output->results[0]->geometry->location->lng; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment