Php collector. This article is an article collection function implemented by php. it is only a simple function, but the source code is very rare. it is suitable for small collection functions. This article is an article collection function implemented by php. it is just a simple function, but the source code is very rare, suitable for small collection functions.
This article is an article collection function implemented by php. it is only a simple function, but the source code is very rare. it is suitable for small collection functions.
Set_time_limit (0 );
?>
Untitled Document
$ Filecontent = getcontent ('http: // 111cn.cn ');
$ Start ='s;
$ End = 'B;
$ Arts = 311;
$ Str = '';
Preg_match ('/(. + ?)/', $ Filecontent, $ arr);/* obtain the 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 "saved the file $ filename successfully.
";
} Else {
Echo 'failed to update the article. click "update ';
}
}
Function replaceHtml ($ str ){
$ Temp = str_replace ('','', $ str );
$ Temp = str_replace ('
', Chr (10), $ temp );
$ Return strip_tags ($ temp );
}
?>
Bytes. This article is an example of using php...