News catcher php. PHPHeadlinesGrabberbyNeilMoomey, www.neilmoomey.com. Youarefreetousethiscodeasyouwish. // PHP Headlines Grabber by Neil Moomey, www.neilmoomey.com.
// You are free to use this code as you wish.
// Make sure you get permission from any web sites you grab headlines from.
// You may 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 down 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.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/532178.htmlTechArticle// for PHP Headlines Grabber by Neil Moomey, www.neilmoomey.com. // You are free to use this code as you wish. // Make sure you get permission from any web sites you grab headlines fro...