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> < /td> </tr> </table> 天淞电子商务开发有限公司 </center> </body> </html> 0
相关文章读者评论发表评论 |
|