/ Published in: PHP
Uses Google Maps API to find the latitude and longitude of a UK postcode (could easily be changed to US Zip Code by setting the URL to google.com).
I'm using file() here, but you might want to use curl..
Expand |
Embed | Plain Text
function GetLatLong($postcode){ $myKey = 'Your_Google_API_Key_Here'; if($data){ $data = json_decode($data[0]); $long = $data->Placemark[0]->Point->coordinates[0]; $lat = $data->Placemark[0]->Point->coordinates[1]; }else return false; }
Comments
Subscribe to comments
You need to login to post a comment.

output=json $data = json_decode($data[0]);
I am not getting any output and by the way what this word jason means..??
I have made one class and caling this Fn from that clas by using object ..is it ok??
The browser is showing nothing...WHY????plz rply
Thanks for you script.. It help me to learn json .. i use this script for facebook application
Thanks again........................
@saravanat Happy to help.