YoWidget with Google Latitude Location

YoWindow widget Questions, Suggestions and Bugs
Post Reply
Posts: 1
Joined: Tue May 21, 2013 6:07 pm
Name: Simon

YoWidget with Google Latitude Location

Post by simonHa » Tue May 21, 2013 6:11 pm

somwhere in this Forum i found a PHP Codesnippet where the location in the weather widget is updated via Google Latitude. This code was old and it didn't work for me, so i adjusted it. Here's the new Code. Just replace GooglelaitudeID with your own and have fun :-)

Code: Select all

<div style="width:220px; height:150px;">


if ( $_GET['user'] ) {
if ( is_numeric( $_GET['user'] ) )
$googleuserId = $_GET['user'];
exit('This isn\'t a valid user id.');

$url = 'http://www.google.com/latitude/apps/badge/api?user='.$googleuserId.'&type=json';

// We get the content
$content = file_get_contents( $url );

// We convert the JSON to an object
$json = json_decode( $content );

$coord = $json->features[0]->geometry->coordinates;
$timeStamp = $json->features[0]->properties->timeStamp;

if ( ! $coord )
exit('This user doesn\'t exist.');

$lat = $coord[1];
$lon = $coord[0];

echo '<object type="application/x-shockwave-flash" data="http://swf.yowindow.com/yowidget3.swf" width="220" height="150">
    	<param name="movie" value="http://swf.yowindow.com/yowidget3.swf"/>
    	<param name="allowfullscreen" value="true"/>
    	<param name="wmode" value="opaque"/>
    	<param name="bgcolor" value="#FFFFFF"/>
    	<param name="flashvars" value="lat='.$lat.'&lon='.$lon.'&time_format=24&unit_system=metric&lang=de&background=#FFFFFF&copyright_bar=false"
        <a href="http://WeatherScreenSaver.com?client=widget&link=copyright"
        style="width:220px;height:150px;display: block;text-indent: -50000px;font-size: 0px;background:#DDF url(http://yowindow.com/img/logo.png) no-repeat scroll 50% 50%;"
        >Wetter Widget</a>
<div style="width: 220px; height: 15px; font-size: 14px; font-family: Arial,Helvetica,sans-serif;">
	<span style="float:left;"><a target="_top" href="http://WeatherScreenSaver.com?client=widget&link=copyright" style="color: #2fa900; font-weight:bold; text-decoration:none;" title="Wetter Widget">ScreenSaver</a></span>
	<span style="float:right; color:#888888;"><a href="http://yr.no" style="color: #2fa900; text-decoration:none;">yr.no</a></span>

User avatar
Posts: 8328
Joined: Mon Sep 21, 2009 11:56 am
Name: Pasha
Location: Saint-Petersburg, Russia

Re: YoWidget with Google Latitude Location

Post by par » Wed May 29, 2013 6:07 am

Thank you, Simon!
Get YoWindow weather app for your phone or tablet.

Image Image Image

Post Reply