There's a problem with my script (parse error on line 10) can you tell me what's wrong?
function grabfromweathercom($A,$O,$Z) {
if(eregi($A."(.)".$O,join('',file("http://weather.com/weather/local/".$Z,$m))){ return $m[1]; }
}
function htmltotext($document) {
$text = ereg_replace('<[>]>', '', $document);
$text = ereg_replace(' {2,}', '', $text);
$text = ereg_replace("\n{1,}","\n",$text);
$text = str_replace("°F","",$text);
$text = str_replace("%","",$text);
$text = str_replace(".Last updated ","\n",$text);
$text = ereg_replace(' ([)]*)','',$text);
$text = str_replace("as reported at ","",$text);
$text = str_replace(", at"," ",$text);
return(explode("\n",$text));
}
//-----------------------------------------------------
function weatherinfo($Z) { $a = new Array();
$a["cond"] = grabfromweathercom("<!-- insert forecast text -->","</td>",$Z);
$a["temp"] = grabfromweathercom("<!-- insert current temp -->","</B></td>",$Z);
$a["feels"]= grabfromweathercom("<!-- insert feels like temp -->","</font></td>",$Z);
$a["uvind"]= grabfromweathercom("<!-- insert UV number -->","</td>",$Z);
$a["wind"] = grabfromweathercom("<!-- insert wind information -->","</td>",$Z);
$a["dewp"] = grabfromweathercom("<!-- insert dew point -->","</td>",$Z);
$a["humd"] = grabfromweathercom("<!-- insert humidity -->","</td>",$Z);
$a["visb"] = grabfromweathercom("<!-- insert visibility -->","</td>",$Z);
$a["baro"] = grabfromweathercom("<!-- insert barometer information -->","</td>",$Z);
// Mom, this is a script (a little bit) that gets forecast from weather.com
$string=implode("\n",file("http://www.weather.com/weather/local/21158"));
$string2=explode("<!-- obs include -->", $string);
$string3=explode("<!-- forecast include -->",$string2[1]);
$string5=explode("<CENTER>",$string3[0]);
$string4=explode("<!-- end of obs/fcst table -->",$string3[1]);
$before = htmltotext($string4[0]);
$a["fore"] = join('',$before);
return $a;
}
$weather = weatherinfo("21158"); extract($weather);
echo "conditions: $cond";