看看这个例子:www.zqba.com/pconline/index.php这个例子是读这个网址的:http://www.pconline.com.cn/et/price/price/city=1&BigkindProduct=2&SmallKindProduct=2&BrandID=1&.html他将内容读出来。就是表格里面的内容读出来,界面风格就改为自己的风格!我想知道如何过滤这些内容。主要是用这个函数:preg_match_all,但preg_match_all这个函数过滤的字符串我不知道怎么写!函数介绍:
http://www.fanqiang.com/a4/b4/20010418/154508.html例如这句过滤是什么:
preg_match_all("/<td  width=\"75\">(.+?)<\/TR>/is",$msg,$matcher);

解决方案 »

  1.   

    <script language="JavaScript1.1">
    <?php 
    $content = file("http://app0.china.com/freecode/out.php?typeid=1000&num=9&t=否");
    $content = implode("\n", $content);
    $content = str_replace("<br>", "", $content);
    $content = str_replace("</a>", "</a><br>", $content);
    $content = str_replace("&nbsp;&nbsp;<a href='http://news.china.com/zh_cn/international/index.html' target='_blank'>……更多内容</a><br>", "", $content);
    echo($content."\n");
    ?>
    </script>这个是我用来读中华网新闻的代码,你看看能不能用上了。
      

  2.   

    看一看php手册上面有关于这方面的函数
      

  3.   

    对啊.主要是出错与不出错的问题...现在还读不出数据.主要是过滤这方面的.我是用表格的宽度来过滤的.如:preg_match_all("/<td  width=\"10%\">(.+?)<\/td>/is",$msg,$matcher);原因是当列数据的列宽为<td width="10%">但是怎么老是不成功呢?求源代码!!!
      

  4.   

    好好,你的这个程序却是不错,很好,比较有创意
    javascript和PHP结合的很好,不错
      

  5.   

    使用socket
    <?php
       $fp = fsockopen("www.csdn.net",80,&$errno,&$errstr,10);
       if (!$fp)
       {
           echo "$errstr($errno)<br>\n";
       }
       else
       {
           fputs($fp,"GET / HTTP/1.0\r\n");
           while (!feof($fp))
           {
                 echo fgets($fp,128);
           }
          fclose($fp);
        }
    ?>
      

  6.   

    preg_match_all("/<td  width=\"10%\">(.+?)<\/td>/is",$msg,$matcher);
    你TD和WIDTH之间多了个空格;
    改一下
    preg_match_all("/<td width=\"10%\">(.+?)<\/td>/is",$msg,$matcher);
    或用这个
    preg_match_all("/<td\040{1}width=\"10%\">(.+?)<\/td>/is",$msg,$matcher);
      

  7.   

    我也正做这个,不过在打开一些页面时会出错,当然只有某些机(网)会,因为在本机运行通过。
    问题还没有解决呢。有经验的过去帮一个啦!
    http://expert.csdn.net/Expert/topic/2616/2616625.xml?temp=8.631533E-02
    最主要就是页面内容过滤的问题。