function Weather($loc) { $s1 = str_replace(" ","+",$loc); $s2 = str_replace(",","%2c",$s1); $t = file_get_contents("http://mobile.wunderground.com/cgi-bin/findweather/getForecast?brand=mobile&query=$s2"); preg_match("/\(.*?), (.*?)\<\/b\>\n/",$t,$loc); preg_match("/\\(.*?)\<\/b\>°\;C\<\/span\>/",$t,$temp ); preg_match("/\\Humidity\<\/td\>\n\\(.*?)\<\/b\>\<\/td\>\<\/tr\>/",$t,$hum); preg_match("/\\(.*?)\<\/b\> km\/h\<\/span\>/",$t,$wind); preg_match_all("/\\\n \\(.*?)\<\/b\>\
\n (.*?).\n (.*?)\n (.*?)° F.\n \/\n (.*?)° C./",$t,$nday); return "Weather for $loc[1] in $loc[2] Temperature: $temp[1]"."C - Humidity: $hum[1] - Wind: $wind[1]"."KM/h\n[".$nday[2][0]." - ".$nday[6][0]."C - ".$nday[3][0]."] [".$nday[2][1]." - ".$nday[6][1]."C - ".$nday[3][1]."] [".$nday[2][2]." - ".$nday[6][2]."C - ".$nday[3][2]."] [".$nday[2][3]." - ".$nday[6][3]."C - ".$nday[3][3]."] [".$nday[2][4]." - ".$nday[6][4]."C - ".$nday[3][4]."] [".$nday[2][5]." - ".$nday[6][5]."C - ".$nday[3][5]."] [".$nday[2][6]." - ".$nday[6][6]."C - ".$nday[3][6]."]"; }