【www.gdgbn.com--C语言】

  / / PHP的新闻抓取由Neil Moomey,。
/ /你可以自由的使用此代码作为您的愿望。
/ /请确保您可以从任何网站,你抓从标题许可。
/ /你可能需要写上您的服务器上的标题,文件以加快速度。

/ /抓斗从文件或网页的源代码网站
if(!($myFile=fopen(http://www.111cn.net,"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);
/ /解压缩一切的开始和结束之间。您需要包括这些行
/ /在标题或选择一些独特的子在HTML庆祝开始
/ /和新闻结束。


$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.gdgbn.com/asp/24985/