专注于互联网--专注于架构

最新标签
网站地图
文章索引
Rss订阅

首页 »PHP教程 » php例子:用PHP抓取新闻的例子 »正文

php例子:用PHP抓取新闻的例子

来源: 发布时间:星期四, 2009年2月12日 浏览:138次 评论:0


<html>

<head>

<title>新闻</title>

<meta http-equiv=\"Content-Type\" content=\"text/html; char=gb2312\">

<meta http-equiv=\"Refresh\" content=\"60;URL=sthief.php\">

<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">

</head>



<body bgcolor=\"#FFFFFF\"><center>

<table width=\"80%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">

<tr align=\"center\">

<td height=\"30\" bgcolor=\"99cc99\">医保网滚动新闻</td>

</tr>

<tr align=\"center\">

<td height=\"30\">新闻每分钟刷新次</td>

</tr>

<?

$handle = fopen(\"http://dailys.sina.com.cn/s1000.shtml\",\"r\");

$sign = 0;

while(!feof($handle))

{

$message = fgets($handle,512);

($sign 1)

{

pr(\"<tr><td>$message</td></tr>\");

}

(ereg(\"新闻开始\",$message,$result))

{

$sign = 1;

}

(ereg(\"新闻结束\",$message,$result))

{

$sign = 0;

}

}

fclose($handle);



?>

<tr>

<td>&nbsp;<

/td>

</tr>

</table>

天淞电子商务开发有限公司

</center>

</body>

</html>


0

相关文章

读者评论

发表评论

  • 昵称:
  • 内容: