How to get Latitude/Longitude from an address (or Geocoding ) using PHP

$geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address=573/1,+Jangli+Maharaj+Road,+Deccan+Gymkhana,+Pune,+Maharashtra,+India&sensor=false');

$output= json_decode($geocode);

$lat = $output->results[0]->geometry->location->lat;
$long = $output->results[0]->geometry->location->lng;



The line above makes a request to Google maps API. Passes the address, and receives the response in JSON format.

The URL has following options

http://maps.google.com/maps/api/geocode/output?parameters



For more details about parameters check out the Google’s geocoding documentation.