The following is a collection mini-program that I collected in php. it is available for test by myself. it is very practical to collect data! The following is a collection mini-program that I collected in php. it is available for test by myself. it is very practical to collect data!
/IUs "; // regular preg_match_all ($ pattern, $ fcontents, $ arr); // print_r ($ arr ); foreach ($ arr [1] as $ k => $ url) {$ title = iconv ('gb2312', 'utf-8 ', addslashes ($ arr [2] [$ k]); // echo $ title; // echo $ url; $ str = iconv ("GB2312", "UTF-8 ", file_get_contents ($ url); $ author = preg_substr ("/author:/", "/<\//", $ str ); // extract the Author $ content = str_substr ('','
', $ Str); // extract the title through a string $ SQL = "INSERT INTO 'caiji' ('title', 'URL', 'content', 'author ') VALUES ('$ title',' $ url', '$ content',' $ author') "; // echo $ SQL."
"; Mysql_query ($ SQL) ;}$ id ++; echo": collecting URL data list $ id... please wait... "; echo" script window. location = '2. php? Id = $ ID' script ";} else {echo" data collection ends. ";}?>
The title setting is unique, which can prevent repeated collection. it is a very good php collection applet. author: Fengyun Wuji
The above is the collection mini-program implemented by php, which must be detailed for collection. For more information, see other related articles in the first PHP community!