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