Php captures Web images

Source: Internet
Author: User
Php captures Web images. PHP is an easy-to-use Web programming language. PHP is an excellent tool with low learning costs and the ability to quickly develop various Web applications. Many people think that PHP has many disadvantages, such as quickanddirty, but & ldquo; there are only two programming languages in the world.

Php captures Web images

PHP is an easy-to-use Web programming language. PHP is an excellent tool with low learning costs and the ability to quickly develop various Web applications.
Although many people think that PHP has many disadvantages, such as quick and dirty, "there are only two programming languages in the world, one being controversial and the other being useless ", isn't it? A good tool is a good tool. PHP is such an excellent language tool.

 '; Get_name1 ($ arr_src1); get_name1 ($ region); get_name1 ($ arr_src3); get_name1 ($ region); get_name2 ($ arr_src1); get_name2 ($ arr_src2 ); get_name2 ($ arr_src3); get_name2 ($ arr_src4 ); echo '===================================================== ======================================================== ====================
'; Return 0;} function get_name1 ($ pic_arr) {// image number and type $ pattern_type = '/.*\/(.*?) $/'; Foreach ($ pic_arr as $ pic_item) {// cyclically retrieve the address of each graph $ num = preg_match_all ($ pattern_type, $ pic_item, $ match_type ); // save the image as a stream $ write_fd = @ fopen ($ match_type [1] [0], "wb"); echo "URL: http://blog.csdn.net/phpfenghuo/article/details ". $ pic_item."
"; @ Fwrite ($ write_fd, CurlGet ($ pic_item); @ fclose ($ write_fd);} return 0;} function get_name2 ($ pic_arr) {// image number and type $ pattern_type = '/. *\/(. *?) $/'; Foreach ($ pic_arr as $ pic_item) {// cyclically retrieve the address of each graph $ num = preg_match_all ($ pattern_type, $ pic_item, $ match_type ); // save the image as a stream $ write_fd = @ fopen ($ match_type [1] [0], "wb"); echo "URL: http://blog.csdn.net/phpfenghuo/article/details ". $ _ POST ['link']. $ pic_item."
"; @ Fwrite ($ write_fd, CurlGet ($ _ POST ['link']. $ pic_item); @ fclose ($ write_fd);} return 0;} // capture the webpage content function CurlGet ($ url) {$ url = str_replace ('&', '&', $ url); $ curl = curl_init (); curl_setopt ($ curl, CURLOPT_URL, $ url); curl_setopt ($ curl, CURLOPT_HEADER, false ); // curl_setopt ($ curl, CURLOPT_REFERER, $ url); curl_setopt ($ curl, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; SeaPort/1.2; Windows NT 5.1; SV1; InfoPath.2) "); curl_setopt ($ curl, region, 'cookie.txt '); curl_setopt ($ curl, CURLOPT_COOKIEFILE, 'cookie.txt'); curl_setopt ($ curl, region, region, 1); curl_setopt ($ curl, CURLOPT_FOLLOWLOCATION, 0); $ values = curl_exec ($ curl); curl_close ($ curl); return $ values ;}?> Webpage image capturing


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.