Home > Backend Development > PHP Tutorial > php collector_PHP tutorial

php collector_PHP tutorial

WBOY
Release: 2016-07-20 11:06:16
Original
992 people have browsed it

This article is an article collection function implemented in PHP. It is just a simple function but the source code is very small. It is suitable for small collection functions.

This article is an article collection function implemented in PHP. It is just a simple function but the source code is very small. It is suitable for small collection functions.


set_time_limit(0);
?>



Untitled Document


$filecontent = getcontent('http://111cn.cn');
$ start = 's;
$end ='b;
$art = 311;
$str = '';


preg_match('/(. +?)/', $filecontent, $arr);/* Get title*/
$init =explode($start,$filecontent);
$array = explode($end, $init[1]);
$str =$str.$arr[1].replaceHtml($array[0]);

function getcontent($url)
{
$retmsg=file_get_contents($url);
return $retmsg;
}

function savato($filename,$content){
if( !empty( $content ) ){
$info = fopen($filename,'w+');
fwrite($info,$content);
fclose($info);
echo "Save file $filename successfully
";
}else{
echo 'Article update failed, Click to update again';
}
}

function replaceHtml($str){
$temp = str_replace(' ',' ',$str);
$temp = str_replace('
',chr(10),$temp );
$ return strip_tags($temp);
}


?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445046.htmlTechArticleThis article is an article collection function implemented in php. It is just a simple function but the source code is only Very few, suitable for small collection functions. This article is an implementation using php...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template