<?php
$class=$_GET["class"];
if($class=="gnga24") $class="gnga24w";//替换新浪天气预报的错误
if($class==true&&$class!="index.") $url="http://weather.sina.com.cn/text/".$class.".html";
else $url="http://weather.sina.com.cn/text/index.shtml";
$handle = fopen ("$url", "rb");
$contents = "";
do {
$data = fread($handle, 8192);
if (strlen($data) == 0)break;
$contents .= $data;
} while(true);
fclose ($handle);
$contents=strstr($contents,"订阅短信天气预报");
$contents=strstr($contents,"<TABLE");
$end=strpos($contents,"<!--开始:底部-->");
$contents=substr($contents,0,$end);
$contents=ereg_replace("href=","href=".$_SERVER[PHP_SELF]."?class=",$contents);
$contents=ereg_replace(".html","",$contents);//替换新浪天气预报的错误
echo $contents;
?>
友情链接 毅辉网络[ 此贴被djks在2008-04-11 13:17重新编辑 ]