网页地址是 http://www.people.com.cn/GB/historic/0826/, 就是将历史上今天内容给提取出来,PHP写。

解决方案 »

  1.   

    $header = array(
      'http'=>array(
        'header'=>"Connection: keep-alive\r\n"
                 ."Accept-Encoding:gzip, deflate\r\n"
                 ."Pragma:no-cache\r\n"
                 ."Cache-Control:no-cache"
      )
    );
    $result     = file_get_contents('http://www.people.com.cn/GB/historic/0826/',false,stream_context_create($header));
    $result     = iconv('gb2312','utf-8//ignore',gzinflate(substr($result,10)));
    preg_match_all('#<a\s+[^>]*class="anavy"[^>]*>((?:(?!</a>).)*)</a>#is',$result,$m);
    echo "<pre/>";
    print_r(array_map('htmlspecialchars',$m[0]));
    print_r($m[1]);