file_get_contents.然后正则匹配活动的那部分内容.以html代码来匹配

解决方案 »

  1.   

    用file_get_contents,获取其HTML代码,然后使用正则什么的,取出来。
      

  2.   

    谢谢楼上的指点,我写了点,感觉有点问题,请帮忙看一下:
    $url="http://www.asjy.org";

    $content= file_get_contents($url);

    preg_match_all ('/(<([\w]+)[^>]*>)(.*)(<\/\\2>)/', $content, $name);

    //print_r($name);
    echo $name[0][32];怎么最开始那里,还是少了个"["啊? 这个站:www.asjy.com 
      

  3.   

    谢谢楼上的指点,我写了点,感觉有点问题,请帮忙看一下:
    $url="http://www.asjy.org";

    $content= file_get_contents($url);

    preg_match_all ('/(<([\w]+)[^>]*>)(.*)(<\/\\2>)/', $content, $name);

    //print_r($name);
    echo $name[0][32];怎么最开始那里,还是少了个"["啊? 
      

  4.   

    乱码解决: echo iconv("GB2312","UTF-8",$name);
    但是内部连接如何替换呢?
      

  5.   


    <?php
            $url="http://www.asjy.org";
            
            $content= file_get_contents($url);
            //echo $content;
            preg_match_all ('/<title>(.+?)<\/title>/i', $content, $name);
            
            //print_r($name);
            echo $name[1][0];
    ?> 
    像这样就输出标题了~,其实匹配网页的正则,很多时候都是取头尾的标签~
      

  6.   

    $url="http://www.asjy.org";
    $link= file($url);
    $link = preg_replace('~\/Article\/~', $url. '/Article/', $link);
    echo $link[129]写好了,假如我想将连接全部连接到首页,也就是:http://www.asjy.org ,应该说 将$url. '/Article/'改为$url就可以了啊。为什么不行呢?