一个显示天气预报的程序
[code] $fcont=file("http://www.bjmb.gov.cn/today.asp"); $arr=array(); for($i=0;$i $tmp=$fcont[$i]; $tmp=ereg_replace(" "," ",$tmp); if(!strstr(strtolower($tmp),"img")){ $tmp=trim(strip_tags($tmp)); } else { $st=ereg_replace("><",">⌒<",$tmp); $stt=split("⌒",$st); foreach($stt as $key => $value){ if(strstr($value,"img") ){ $tmp=$value; $tmp=ereg_replace("src=","width=30 height=30 align=absmiddle src=",$tmp); if(strstr($tmp,"bt9.jpg") || strstr($tmp,"colline.gif")) $tmp=""; } } } if(trim($tmp)!="" && trim($tmp)!=" ") $arr[]=$tmp; } $yb=array(); for($i=2;$i $yb[]=$arr[$i]; } ?>
[/code]
|