[Tfug] PHP Question

George Cohn gwcohn at simplybits.net
Sat Feb 10 22:35:50 MST 2007


Thanks to Stephen Hooper's clue, I found the problem in this line:

if (preg_match("/<wind_mph>([0-9.]+)<\/wind_mph>/i",$weatherPage,$matches))
{
         $currentWindSpeed=$matches[1];
}

I forgot the . after the 0-9 and had an extra > after the second 
wind_mph.  So it wasn't parsing the data and without data for both 
WindDirection and WindSpeed, the program would just exit at that point.

Hell to be old and blind.  ;-)

Anyway, it works super now.  I can dial an extension on my Asterisk box 
and it downloads the latest weather info from

<http://www.nws.noaa.gov/data/current_obs/KTUS.xml>

parses it and plays it back.  Then she politely says goodbye and hangs up.

George Cohn




More information about the tfug mailing list