Get latitude and longitude from address

Posted: March 27, 2012 in PHP
<?
	$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address=ahmedabad&sensor=false');
	$output= json_decode($geocode);	
	echo '--latitude-->'.$lat = $output->results[0]->geometry->location->lat;
	echo '--longitude-->'.$long = $output->results[0]->geometry->location->lng;
?>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s