Well, I'd say that's OT in all but this topic
http://fornits.com/wwf/viewtopic.php?to ... m=7&Sort=D (http://fornits.com/wwf/viewtopic.php?topic=2369&forum=7&Sort=D)
LOL
Anyway, here's the code. As you can see, wunderground.com has changed something in their output format so that the string doesn't parse out the same way it used to. Oh well, it was just for fun anyway.
$show_weather=1;
if ($show_weather==1){
$fh=fopen("http://www.wunderground.com/US/PA/Pittsburgh/KAGC.html","r");
while (!feof($fh)){
$weatherpage .= fread($fh,1024);
}
$weatherpage = strip_tags($weatherpage);
$weatherpage =substr($weatherpage,strpos($weatherpage,"Observed"),strlen($weatherpage));
$end=(strpos($weatherpage,"Visibility")-strpos($weatherpage,"Conditions"))-11;
$weatherpage =substr($weatherpage,(strpos($weatherpage,"Conditions")+11),$end);
// $weatherpage="rain";
if (preg_match ("/sno/i",$weatherpage) || preg_match ("/flu/i",$weatherpage) || preg_match("/rain/i",$weatherpage)){
$snow_no = 8; // snow number
$snow_speed = 7; // smaller number moves the snow faster
$snow_stx="stx = 0.02 + Math.random()/10";
$snow_img="/wwf/images/snow2.gif";
if (preg_match ("/sno/i",$weatherpage)){
if (preg_match ("/lig/i",$weatherpage)){
$snow_no = 12; // snow number
$snow_speed = 7; // smaller number moves the snow faster
}else if (preg_match ("/heav/i",$weatherpage)){
$snow_no = 16; // snow number
$snow_speed = 4; // smaller number moves the snow faster
}else{
$snow_no = 10; // snow number
$snow_speed = 4; // smaller number moves the snow faster
}
}else if (preg_match ("/flu/i",$weatherpage)){
if (preg_match ("/lig/i",$weatherpage)){
$snow_no = 3; // snow number
$snow_speed = 7; // smaller number moves the snow faster
}else{
$snow_no = 4; // snow number
$snow_speed = 4; // smaller number moves the snow faster
}
}else if(preg_match("/rain/i",$weatherpage)){
$snow_stx="0;";
$snow_img="/wwf/images/raindrop.gif";
}
?>
}//end check for weather type
}//end check for index
?>
I have never killed a man, but I have read many obituaries with great pleasure.
--Clarence Darrow
_________________
Ginger Warbis ~ Antigen
American drug war P.O.W.
Seed sibling `71 - `80
Straight South (Sarasota, FL)
10/80 - 10/82
Anonymity Anonymous