很简单的,
远程打开url,然后读取,折分就可以了。

解决方案 »

  1.   

    file("http://www.sohu.com")可以抓取网页
      

  2.   

    我想这样做,将抽取的页面变为XML形式,这样在XML中抽取数据就方便了,
    XML中如何用XML呀?
      

  3.   

    下面这个是偷取新浪天气预报的
    参考一下吧:
    ============================
    <?
    if (function_exists('set_time_limit') == 1 && @ini_get('safe_mode') == 0) {
            @set_time_limit(1000);
    }
    @ob_implicit_flush();
    @clearstatcache();
    ?>
    <html><head>
    <meta http-equiv="Content-type" content="text/html; charset=gb2312">
    <title>天气预报</title>
    <style>
    td,p,li,select,input {font-size:12px}
    .l15{line-height:150%;}
    IMG{border:0px}
    .img01{border:1 solid #000000;}
    .f14{font-size:14px;}
    A:hover {color: ff0000;}
    A.title1,A.title1:hover {font-size:17px;font-family:arial;font-weight:bold;text-decoration:none;color:#000000;}
    A.title2:link,A.title2:visited {text-decoration:none;color:#000000;}
    A.title2:active,A.title2:hover {text-decoration:none;color:#ff0000;}
    A.sinatail:link,A.sinatail:visited {text-decoration:underline;color:#0000ff;font-size:12px}
    A.sinatail:active,A.sinatail:hover {text-decoration:underline;color:#ff0000;font-size:12px}.h3 {font-size:7px;color:#FFBD00}A.a01:link,A.a01:visited {text-decoration:none;color:#07015B;}
    A.a01:active,A.a01:hover {text-decoration:none;color:#ff0000;}A.a02:link,A.a02:visited {color:#808080;}
    A.a02:active,A.a02:hover {color:#ff0000;}A.a03:link,A.a03:visited {text-decoration:none;color:#808080;}
    A.a03:active,A.a03:hover {text-decoration:none;color:#ff0000;}.td01{border-right:1 solid #ffffff;border-bottom:1 solid #ffffff}
    </style>
    </head>
    <body bgcolor=#ffffff topmargin=5 marginheight=5 leftmargin=5 marginwidth=5>
    <center>
    <?
    $action=$_GET[action];
    if(!$action)$action="index";
    $url="http://weather.news.sina.com.cn/".$action.".html";
    $ob=fopen($url,"r") ;          
                    // $str = @fread ($ob, 49306);
    $str='';
    $temp='';
    while(!feof($ob)){        
            $temp=fgets($ob,1024);
            $str=$str.$temp;
            }
    fclose($ob);
    $a=explode("<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>",$str);
    if(strstr($a[3],'更新')){$s1=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[4];
    $a[5]=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[5];
            $count=count($a);
       for($i=6;$i<$count;$i++){
               $a[5]=$a[5]."<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[$i];
            }
    $a1=explode("<!-- 访问Log统计测试 : begin -->",$a[5]);
    $str=$s1.$a1[0];
    }else{
    $s1=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[3];
    $a[4]=" <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[4];
       $count=count($a);
       for($i=5;$i<$count;$i++){
               $a[4]=$a[4]."<TABLE cellSpacing=0 cellPadding=0 width=750 border=0>".$a[$i];
            }
    $a1=explode("<!-- 访问Log统计测试 : begin -->",$a[4]);
    $str=$s1.$a1[0];
    }
    $str=str_replace("href=","href=?action=",$str);
    $str=str_replace(".html","",$str);
    echo $str;
            
    ?>
    </center>
    </body>
    </html>
      

  4.   

    其中的action请初始化为:index48
      

  5.   

    晕了 http://weather.news.sina.com.cn/index48.html 这个数据几个月没更新了
      

  6.   

    http://www.yubeinet.com/bbs/wdbread.php?forumid=15&filename=f_354&fpage=3
      

  7.   

    这个贴怎么还在阿作  者:  mdot ()  
    等  级:    
    信 誉 值:  87  
    难怪