function weather($url="http://weather.yahoo.com/forecast/POXX0005_c.html") {
//$url=$DOCUMENT_ROOT."/yahoo1.txt";
//echo $url;
$fp=@file($url);
if ($fp) {
$cont=implode("\n", $fp);
$arr=explode("<!----------------------- FORECAST ------------------------->", $cont);
$arr=explode("<!--ENDFC-->", $arr[1]);
//print_r($arr);
$arr=$arr[0];
$arr=explode("\n", $arr);
$img=array();
//$tm_high=array();
//$tm_down=array();
//echo strrchr("ghbn 111 jkhjh", "111")."<br>";
$imag="";
$lows="";
$highs="";
$day_of_week=array("<b>Today</b>", "<b>Tomorrow</b>", "<b>Mon</b>", "<b>Tue</b>", "<b>Wed</b>", "<b>Thu</b>", "<b>Fri</b>", "<b>Sat</b>", "<b>Sun</b>");
$day_of_week1=array("Сегодня", "Завтра", "Пон", "Вт", "Ср", "Чт", "Пт", "Суб", "Вс");
$str_week="";
while(list($key, $val)=each($arr)) {
while(list($key1, $day)=each($day_of_week)) {
if ($str1=strstr($val, "$day")) {
$str_week.="<td class=top_week align=center>".$day_of_week1[$key1];
}
}
reset($day_of_week);
if ($str1=strstr($val, "<img src")) {
$imag.="<td align=center>".$str1."</td>\n";
}
if ($str1=strstr($val, ">High:<")) {
$str1=substr($str1, 50, 3);
//echo (int)$str1.'<br>';
//$str1=$arr[$key+3];
//$str1=$arr[$key+6];
/*if (ereg("[-]{0,1}[0-9]{1,3}",$str1, $regs )) {$highs.="<td class=center_week align=center>????: <b>".$regs[0]."</b>\n";}
else{$highs.="<td align=center class=center_week> \n";}
}*/
if ((int)$str1) {$highs.="<td class=center_week align=center>День: <b>".(int)$str1."</b>\n";}
else{$highs.="<td align=center class=center_week> \n";}
}
if ($str1=strstr($val, ">Low:<")) {
$str1=substr($str1, 49, 3);
//echo (int)$str1.'<br>';
/*if (ereg("[-]{0,1}[0-9]{1,3}",$str1, $regs )) {$highs.="<br>????: <b>".$regs[0]."</b></td>\n";}
else{$highs.="<br> </td>\n";};
}*/
if ((int)$str1) {$highs.="<br>Ночь: <b>".(int)$str1."</b></td>\n";}
else{$highs.="<br> </td>\n";};
}
}
$weather="<table>"."<tr>".$str_week."<tr>".$imag."<tr>".$highs."</table>";
return $weather;
}
return false;
}