Ads Inside Post

Search in This Blog

latitude and longitude by zip in php

PROBLEM:
How to get latitude and longitude by zip/pin in php

SOLUTION:
Here I am demonstrating to you that how can you get latitude and longitude by zip code or pin code in php.

$pin="208017";
$full_url = "http://maps.googleapis.com/maps/api/geocode/json?address=".$pin."&sensor=false";
$details=file_get_contents($full_url);
$rs = json_decode($details,true);
$lat=$rs['results'][0]['geometry']['location']['lat'];
$lng=$rs['results'][0]['geometry']['location']['lng'];
echo  "Latitude :" .$lat;
echo '<br>';
echo "Longitude :" .$lng;