In article <023601c15de3$c05d8bc0$[EMAIL PROTECTED]>, [EMAIL PROTECTED] says... > Is the PHP code you provided below working, I need something like than and i > wonder if i could use it. > NOBBY
Actually, right now I'm using some code stripped from the PHP-Nuke Weather add-on. But it gets its weather from msnbc and I'd rather get it from the feds cause they won't change their output. You must know the 4 letter ACCID value, you can get it from NOAA. I use KAUS for Austin, TX like this: http://myhost.com/weather.php?Default_accid=KAUS <? /* Code derived from the PHP-Nuke Weather Add-On */ $fontface = "Arial"; $fontcolor1 = "#000000"; $fontsize1 = "2"; $filehandle = fsockopen("www.msnbc.com", 80, $num_error, $str_error, 30); if(!$filehandle) { print "Weather is is not available: $str_error ($num_error)\n"; } else { fputs($filehandle,"GET http://www.msnbc.com/m/chnk/d/weather_d_src.asp?acid= $Default_accid HTTP/1.0\n\n"); // initialize variables $v_City = ""; $v_SubDiv = ""; $v_Country = ""; $v_Region = ""; $v_Temp = ""; $v_CIcon = ""; $v_WindS = ""; $v_WindD = ""; $v_Baro = ""; $v_Humid = ""; $v_Real = ""; $v_UV = ""; $v_Vis = ""; $v_LastUp = ""; $v_Fore = ""; $v_Acid = ""; while (!feof($filehandle)) { $grabline = fgets($filehandle, 4096); $grabline= trim($grabline) . "\n"; if (substr($grabline,7,4) == "City") { $v_City = substr($grabline,15,20); } if (substr($grabline,7,6) == "SubDiv") { $v_SubDiv = substr($grabline,17,20); } if (substr($grabline,7,7) == "Country") { $v_Country = substr($grabline,18,20); } if (substr($grabline,7,6) == "Region") { $v_Region = substr($grabline,17,20); } if (substr($grabline,7,4) == "Temp") { $v_Temp = substr($grabline,15,20); } if (substr($grabline,7,5) == "CIcon") { $v_CIcon = substr($grabline,16,20); } if (substr($grabline,7,5) == "WindS") { $v_WindS = substr($grabline,16,20); } if (substr($grabline,7,5) == "WindD") { $v_WindD = substr($grabline,16,20); } if (substr($grabline,7,4) == "Baro") { $v_Baro = substr($grabline,15,20); } if (substr($grabline,7,5) == "Humid") { $v_Humid = substr($grabline,16,20); } if (substr($grabline,7,4) == "Real") { $v_Real = substr($grabline,15,20); } if (substr($grabline,7,2) == "UV") { $v_UV = substr($grabline,13,20); } if (substr($grabline,7,3) == "Vis") { $v_Vis = substr($grabline,14,20); } if (substr($grabline,7,5) == "LastUp") { $v_LastUp = substr($grabline,16,20); } if (substr($grabline,7,4) == "Fore") { $v_Fore = substr($grabline,15,200); } if (substr($grabline,7,4) == "Acid") { $v_Acid = substr($grabline,15,20); } } $v_City = substr($v_City,0,strlen($v_City)-3); $v_SubDiv = substr($v_SubDiv,0,strlen($v_SubDiv)-3); $v_Country = substr($v_Country,0,strlen($v_Country)-3); $v_Region = substr($v_Region,0,strlen($v_Region)-3); $v_Temp = substr($v_Temp,0,strlen($v_Temp)-3); $v_CIcon = substr($v_CIcon,0,strlen($v_CIcon)-3); $v_WindS = substr($v_WindS,0,strlen($v_WindS)-3); $v_WindD = substr($v_WindD,0,strlen($v_WindD)-3); $v_Baro = substr($v_Baro,0,strlen($v_Baro)-3); $v_Humid = substr($v_Humid,0,strlen($v_Humid)-3); $v_Real = substr($v_Real,0,strlen($v_Real)-3); $v_UV = substr($v_UV,0,strlen($v_UV)-3); $v_Vis = substr($v_Vis,0,strlen($v_Vis)-3); $v_LastUp = substr($v_LastUp,0,strlen($v_LastUp)-3); $v_Fore = substr($v_Fore,0,strlen($v_Fore)-3); $v_Acid = substr($v_Acid,0,strlen($v_Acid)-3); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title><? $v_City ?> Weather</title> </head> <body> <table width="150" cellspacing="0" cellpadding="0" border="1"> <tr> <td colspan="5" name="cityst" align="center"> <font face="<? $fontface ?>" color="<? $fontcolor1 ?>" size="<? $fontsize1 ?>"><b><?$v_City?>, <?$v_SubDiv?></b><font> </td> </tr> <tr> <td colspan="3" name="temptext">Temperature:</td> <td colspan="2" name="tempdata"><?$v_Temp ?>°</td> </tr> <tr> <td colspan="3" name="humidtext">Humidity:</td> <td colspan="2" name="humiddata"><?$v_Humid ?>%</td> </tr> <tr> <td colspan="3" name="barotext">Barometric Pressure:</td> <td colspan="2" name="barodata"><?$v_Baro ?></td> </tr> <tr> <td name="windtext">Wind:</td> <td name="winddir"><?$v_WindD ?></td> <td name="attext">at</td> <td name="windspd"><?$v_WindS ?></td> <td name="mphtxt">mph</td> </tr> </table> </body> </html> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]