Posted By

deadpixel on 05/13/08


Tagged

info favicon weather


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

basicmagic
mmccrack


current weather favicon


 / Published in: PHP
 

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

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

Report this snippet  

You need to login to post a comment.