Latitude where am i?
Wednesday, February 3rd, 2010Recently I have been playing around with google latitude. The footer below is a wordpress plugin I made that echos out my current location to the city level at the base of the blog. enjoy
/*
Plugin Name: Hello Latitude
Plugin URI: http://wordpress.org/#
Description: working on it
Author: Matthew O'Gorman
Version: 0.1
Author URI: http://rldn.net/
License :AGPLv3
*/
function hello_latitude() {
$googleLatID=”"; //find this at http://www.google.com/latitude/apps/badge
$url =”http://www.google.com/latitude/apps/badge/api?user=”.$googleLatID.”&type=json”;
try{
$contents = file_get_contents($url);
$contents = utf8_encode($contents);
$results = json_decode($contents, true);
$loc=”I am in “.$results['features'][0]['properties']['reverseGeocode'];
echo $loc;
}
catch (Exception $e){
echo ‘LOCATION NOT FOUND!’;
}
}
add_action(’wp_footer’, ‘hello_latitude’);
?>