<?php
$url="http://qq327481723.blog.hexun.com/cate.aspx?cateid=246271&cate=%cd%e2%bb%e3%bb%c6%bd%f0%ca%d3%c6%b5%d0%d0%c7%e9%b7%d6%ce%f6";//目标站点
echo $url;
$fp=@fopen($url,"r") or die("超时");
$fcontents = file_get_contents($url);ereg("(.*)", $fcontents, $regs);
echo iconv("gb2312","utf-8","$regs[1]");
?>

解决方案 »

  1.   

    你的采集程序过于简陋
    如果你加上
    CURLOPT_REFERER
    CURLOPT_USERAGENT
    等,一般就可以了.//伪造REFERER,HEADER,USERAGENT   
    curl_setopt($ch, CURLOPT_REFERER, $referURL);  
    curl_setopt($ch, CURLOPT_URL, $queryURL); curl_setopt($ch,CURLOPT_HTTPHEADER,$header);   
    curl_setopt($ch, CURLOPT_USERAGENT, $useragent);    
    curl_setopt($ch, CURLOPT_COOKIEJAR, COOKIEJAR);   
    curl_setopt($ch, CURLOPT_COOKIEFILE, COOKIEJAR);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1)
      

  2.   

    file_get_contents适用于静态网页
    cate.aspx是一个动态网页。用cURL代替吧
      

  3.   

    $opts = array(   
      'http'=>array(   
        'method'=>"GET",   
        'header'=>"Accept-language: en\r\n" .    
                  "Cookie: foo=bar\r\n"  
      )   
    );   
      
    $context = stream_context_create($opts);   
      
    /* Sends an http request to www.example.com  
       with additional headers shown above */  
    $fp = fopen('http://www.example.com', 'r', false, $context);   
    fpassthru($fp);   
    fclose($fp); 
      

  4.   

    伪造信息,假装是浏览器访问
    CURL就很不错,snoopy也可以,file_get_contents也能带参数伪造……
      

  5.   

    +++要伪造头信息。
    $opts = array(
      'http'=>array(
        'method'=>"GET",
        'header'=>"Host: qq327481723.blog.hexun.com\r\n" . 
                  "Accept-language: zh-cn\r\n" . 
                  "User-Agent: mozilla/5.0 (windows; u; windows nt 5.1; zh-cn; rv:1.9.2.3) gecko/20100401 firefox/3.6.3\r\n" .
                  "Accept: *//*"
      )
    );
    $context = stream_context_create($opts);
    $url = "http://qq327481723.blog.hexun.com/cate.aspx?cateid=246271&cate=%cd%e2%bb%e3%bb%c6%bd%f0%ca%d3%c6%b5%d0%d0%c7%e9%b7%d6%ce%f6";
    $html = file_get_contents($url, False, $context);
    echo $html;