看看这个例子: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);
http://www.fanqiang.com/a4/b4/20010418/154508.html例如这句过滤是什么:
preg_match_all("/<td width=\"75\">(.+?)<\/TR>/is",$msg,$matcher);
<?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(" <a href='http://news.china.com/zh_cn/international/index.html' target='_blank'>……更多内容</a><br>", "", $content);
echo($content."\n");
?>
</script>这个是我用来读中华网新闻的代码,你看看能不能用上了。
javascript和PHP结合的很好,不错
<?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);
}
?>
你TD和WIDTH之间多了个空格;
改一下
preg_match_all("/<td width=\"10%\">(.+?)<\/td>/is",$msg,$matcher);
或用这个
preg_match_all("/<td\040{1}width=\"10%\">(.+?)<\/td>/is",$msg,$matcher);
问题还没有解决呢。有经验的过去帮一个啦!
http://expert.csdn.net/Expert/topic/2616/2616625.xml?temp=8.631533E-02
最主要就是页面内容过滤的问题。