For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Saturday, November 08, 2014

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;

Share:

0 comments:

Post a Comment

Add Dependent Scripts

   here is the code that allow to add dependent script :         <script>         const addDependentScripts = async function( scriptsT...

Ads Inside Post

Powered by Blogger.

Arsip