首页/技术开发/内容

一个很容易的PHP的后端脚本,能够从(某个网中)得到最新新闻。

技术开发2024-02-27 阅读()
[摘要](!(filesize(cache_file))) ) fp1=fopen("http://www.ourjia.net/index.shtml", "r"...
(!(filesize($cache_file))) ) {
$fp1=fopen("http://www.ourjia.net/index.shtml", "r");
$string=fread($fp1,20000);

ereg("<!-- MITTE (NEWS) -->(.*)<!-- MITTE (NEWS-UEBERBLICK) -->",
$string, $matches);
$match=str_replace("HREF="/newsticker/","href="http://www.ourjia.net/",$matches[1]);

$exp="#newsticker/data/(.*)/">(.*</FONT></B>)#i";
preg_match_all($exp, $matches[1], $matchin);

for($i=0;$i<count($matchin[1]);$i++)
   {
$body.= "$link_prefix <a href="http://www.ourjia.net/data/".$matchin[1][$i]."/">" . $matchin[2][$i]. "</a><br>n";
   }
$body = eregi_replace( "</A></FONT></B>", "", $body);
fclose($fp1);

$fpwrite = fopen($cache_file,'w');
fputs($fpwrite,  "$body");
fclose($fpwrite);
}
include($cache_file);
?>

注意:1:这里的www.ourjia.net该为为有新闻更新系统的网站列如:
        http://www.heise.de/newsticker。  

【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    


第1页  第2页  第3页  第4页  第5页 

……

相关阅读