Page 1 of 1

YoWidget with Google Latitude Location

Posted: Tue May 21, 2013 6:11 pm
by simonHa
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 = ''.$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="" width="220" height="150">
    	<param name="movie" value=""/>
    	<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=""
        style="width:220px;height:150px;display: block;text-indent: -50000px;font-size: 0px;background:#DDF url( 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="" style="color: #2fa900; font-weight:bold; text-decoration:none;" title="Wetter Widget">ScreenSaver</a></span>
	<span style="float:right; color:#888888;"><a href="" style="color: #2fa900; text-decoration:none;"></a></span>

Re: YoWidget with Google Latitude Location

Posted: Wed May 29, 2013 6:07 am
by par
Thank you, Simon!