php preg_match获取新浪新闻代码

作者:简简单单 2008-08-09


   
       
        最新新闻
       
   
   
       


           

php
$str = file_get_contents("http://news.163.com/rank/");
preg_match_all("#
(.*)
#i",$str,$match);

for($i=0; $i {
            echo "tttt".preg_replace("#()(.*)(

)#i","\2",$match[0][$i])."n";
}
?>

           


           

php
$str = file_get_contents("http://news.sina.com.cn/hotnews/");
preg_match_all("#(.*)#i",$str,$match);
for($i=0;$i {
                    echo "tttt".preg_replace("#(.*)#i","\1",$match[0][$i])."n";
}
?>

           


           

php
$str = file_get_contents("http://news.qq.com/paihang.htm");
preg_match_all("#(.*)#i",$str,$match);
for($i=0;$i {
            echo "tttt".preg_replace("#(.*)#i","\1",$match[0][$i])."n";
}
?>

           


       

       
   

上一个:编程规则与基本语法 下一个:php读取msn上的用户信息

相关文章

精彩推荐