Collection of small programs implemented by php.

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.