Interception of yahoo.com.cn News [for experimentation only]
There are a lot of procedures for intercepting home news, but not successful.
They work in two ways, one is to use some web site called backend backend database interface, the other is the hard sound based on HTML code interception. The latter is used in this procedure. It should be said that fault-tolerant performance is better.
$open = fopen ("http://www.yahoo.com.cn/index.html", "R");//web address
$read = Fread ($open, 15000);
Fclose ($open);
$search = Eregi (" (.*) ", $read, $printing);//intercept a source code, it is best to analyze the source code first
The following begins to remove the Jong Yuyuan code
$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]);
$printing [1] = Str_replace (""," ", $printing [1]);
$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 < $headlines; $i + +) {
Print "News". ($i + 1). "): $content [$i]
*//exciting time is up! It's showing up!
}
?>
Debug through under Php3/php4 Apache.
The above describes also the interception of the home page news-examples, including the content, I hope the PHP tutorial interested in a friend helpful.