有很多截取首页新闻的程序,但是并不能成功。
他们的工作原理无非两种,一种是采用某些网站称之为backend的后端数据库接口,另一种则是硬声声的根据html代码截取。本程序采用的是后者。应该说,容错性能比较好。
$open = fopen("http://www.yahoo.com.cn/index.html", "r");//网页地址
$read = fread($open, 15000);
fclose($open);
$search = eregi("(.*)", $read, $printing);//截取一段源代码,最好先分析一下源代码
//以下开始取出容余源代码
$printing[1] = str_replace("href=\"/homer/?", "href=\"", $printing[1]);
$printing[1] = str_replace("href=\"/headlines/fullcoverage/", "href=\"http://www.yahoo.com.cn/headlines/fullcoverage/", $printing[1]);
$printing[1] = str_replace("
$printing[1] = str_replace("
$printing[1] = str_replace(" class=sbody", "", $printing[1]);
$printing[1] = str_replace("", "", $printing[1]);
$content = $printing[1];
$content = explode("-", $content);
$headlines = sizeof($content);
for ($i = 0; $i
print "新闻".($i+1).") : $content[$i]
";//激动人心的时刻到了!显示出来了!
}
?>
在php3/php4 apache下调试通过。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Atom editor mac version download
The most popular open source editor

WebStorm Mac version
Useful JavaScript development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
