Google Latitude PHP JSON script
By: a guest | Jun 15th, 2010 | Syntax:
PHP | Size: 0.60 KB | Hits: 455 | Expires: Never
<?php
function getGLatitude()
{
$url = "http://www.google.com/latitude/apps/badge/api?user=MY_USER_ID&type=json";
$ch = curl_init($url)
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $output contains the output string
$output = curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
$json = json_decode($output, true);
return '<a href="http://maps.google.com?q='.urlencode($json['features'][0]['properties']['reverseGeocode']).'">'.$json['features'][0]['properties']['reverseGeocode'].'</a>';
}
?>