PHP Headlines Grabber by Neil Moomey, www.neilmoomey.com.
You is free to use the This code as you wish.
Make sure your get permission from any Web sites your grab headlines from.
Want to write the headlines to a file on your server to speed things up.
Grab source code from a file or Web site
if (! ( $myFile =fopen ("http://www.lndaily.com.cn/web/yw3.htm", "R")))
{
echo "The news interface is under for maintenance.";
Exit
}
while (!feof ($myFile))
{
Read each line and add to $myLine
$myLine. =fgets ($myFile, 255);
}
Fclose ($myFile);
Extract everything between start and end. You need to include these lines
In the headlines or pick some unique substring in the HTML to mark the start
And end of the news.
$start = "
$start _position=strpos ($myLine, $start);
$end _position=strpos ($myLine, $end) +strlen ($end);
$length = $end _position-$start _position;
$myLine =substr ($myLine, $start _position, $length);
Display HTML
Echo $myLine;
?>
http://www.bkjia.com/PHPjc/532178.html www.bkjia.com true http://www.bkjia.com/PHPjc/532178.html techarticle //PHP Headlines Grabber by Neil Moomey, www.neilmoomey.com.//Is free to use this code as you wish.//Make Sur E-Get permission from any Web sites grab headlines fro ...