Convert an address to geocode Latitude/Longitude positioning with PHP and Google Maps
-
<?php
-
$address = ’201 S. Division St., Ann Arbor, MI 48104′; // Google HQ
-
-
$geocode=file_get_contents(‘http://maps.google.com/maps/api/geocode/json?address=’.$prepAddr.‘&sensor=false’);
-
-
-
$lat = $output->results[0]->geometry->location->lat;
-
$long = $output->results[0]->geometry->location->lng;
-
-
echo $address.‘<br>Lat: ‘.$lat.‘<br>Long: ‘.$long;
-
-
?>