The given PHP script convert an address to geocode Latitude/Longitude positioning with using Google Map API. It only allow 2500 request for free users.
Here we passing address to api and get json data. json nothing but its a data interchange format. we can get latitude and longitude parsing json.
<?php $address = 'Century Plaza, Tenampet, Chennai 600018.'; $prepAddr = str_replace(' ','+',$address); $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false'); $output= json_decode($geocode); $lat = $output->results[0]->geometry->location->lat; $long = $output->results[0]->geometry->location->lng; echo '<br>Lat: '.$lat.'<br>Long: '.$long; ?>