本帖最后由 hft24dq 于 2011-03-01 18:09:57 编辑

解决方案 »

  1.   

    说明下,由于源文件很长,我剪短了一些。
    或者请打开链接http://www.24dq.com/?brand-showList.html查看源码,看完整的文本。谢谢大家!
      

  2.   


    $str="";//页面的源码需要转义
    preg_match("/\<div\sclass\=\"page3\"[.\n]*/",$str,$arr);
      

  3.   

    lz是要匹配<div class="page3"></div>里面内容还是匹配到</html>结尾的啦
    <?php
    //匹配<div class="page3"></div>
    $file=file_get_contents('http://www.24dq.com/?brand-showList.html');
    $pattern='/<div class="page3">(.*?)<\/div> <div id="Foot">/is';
    preg_match($pattern,$file,$result);
    print_r($result[1]);
    ?>
    匹配到</html><?php
    $file=file_get_contents('http://www.24dq.com/?brand-showList.html');
    $pattern='/<div class="page3">(.*?)<\/html>/is';
    preg_match($pattern,$file,$result);
    print_r($result[1]);
    ?>
      

  4.   

    你好,我是想从page3到文件尾部!
    您的第二段我试了下,很接近了,但是css部分和最后的js调用部分没有取到!
      

  5.   


    $url='http://www.24dq.com/?brand-showList.html';
    $str=file_get_contents($url);
    preg_match('/(<div\s*class="page3">[\s\S]*?<\/html>$)/',$str,$match);
    echo '<pre>';
    echo $match[1];
    echo '</pre>';look
      

  6.   

    $pattern='/<div class="page3">([\w\W]*?)<\/html>/';
    正则这样写,是可以的