View Full Version : Weather widgets

07-24-2010, 02:45 PM
Hi Chaps

I am trying to find a weather widget which can be resizable. Ideally a widget which is like 60 x 60 pxs as I don't have much space.

Any ideas?

07-27-2010, 10:01 AM
why not write your own using googles weather API

Just throw a city at it


just need to parse the xml response

07-27-2010, 03:04 PM
Had some time on my hands (quite rare these days)

here is a little parser I knocked up which pulls out the icon image path from the google weather XML response

you can either replicate the path structure and use your own images or you could use a switch to remap the paths altogether


//Name of your place

//Initialize CURL
$curl = curl_init();

$timeout = 0;

//Set CURL options
curl_setopt ($curl, CURLOPT_URL, 'http://www.google.com/ig/api?weather='.$place.'&hl=en');
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);


//close CURL

// Parse the XML response
$xml = new SimplexmlElement($xml_str);

$icons = array();

foreach($xml->weather as $item) {

foreach($item->forecast_conditions as $new) {

$icons[] = $new->icon['data'];

// output array of image paths (debug use only)
echo "<pre>";
echo "</pre>";


07-27-2010, 04:23 PM
Could you use the Google geolocator to output the user's location and feed it into $place?

07-27-2010, 07:15 PM
Yes of course

I have used this on a site before


Never looked at the google solution

07-27-2010, 07:26 PM
A nice set of icons/sprite you could use with it... here (http://www.istockphoto.com/file_thumbview_approve/5872384/2/istockphoto_5872384-weather-icons-color.jpg)