Return to Snippet

Revision: 6253
at May 13, 2008 03:42 by deadpixel


Initial Code
<?php
  $zipcode = 94704;
  require_once('magpierss/rss_fetch.inc');
  $url = "http://rss.weather.com/weather/rss/local/" . $zipcode . "?cm_ven=LWO&cm_cat=rss&par=LWO_rss";
  $rss = fetch_rss($url);
  $desc = array();
  foreach ($rss->items as $item) {
    $desc[] = $item['description'];
  }
  $icon = substr($desc[0],(stripos($desc[0], "src=")+5),(stripos($desc[0], "alt=\"\"")-(stripos($desc[0], "src=")+5)-2));
  echo "<LINK REL=\"SHORTCUT ICON\" HREF=\"" . $icon . "\">";
?>

Initial URL

                                

Initial Description
requires MagpieRSS. copy and paste into html head tag, then edit zipcode variable to reflect what weather you want to show.

Initial Title
current weather favicon

Initial Tags

                                

Initial Language
PHP