The Markdown editor of the blog Park is too boring @!!! Forget it. No format !!!
/********************** Curl series *************** * ******* // obtain data (including POST and HEADER) through curl) /** $ url: if it is not an array, It is http. If it is an array, It is https * $ header: header file * $ post: Submit the array form in post mode * $ cookies: 0: No cookie by default; 1: Set; 2: Get */public function curl_allinfo ($ urls, $ header = FALSE, $ post = FALSE, $ cookies = 0) {$ url = is_array ($ urls )? $ Urls ['0']: $ urls; $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ url); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 ); // submit if ($ header! = FALSE) {curl_setopt ($ ch, CURLOPT_HTTPHEADER, $ header);} // if ($ post! = FALSE) {curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post);} if ($ cookies = 1) {curl_setopt ($ ch, CURLOPT_COOKIEJAR, "cookiefile");} else if ($ cookies = 2) {curl_setopt ($ ch, CURLOPT_COOKIEFILE, "cookiefile");} if (is_array ($ urls )) {curl_setopt ($ ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt ($ ch, CURLOPT_SSL_VERIFYHOST, false);} $ data = curl_exec ($ ch); curl_close ($ ch ); return $ data ;}
Oupag bbs: http://www.oupag.com/bbs/thread-7814-1-1.htmlcnblogs:http://www.cnblogs.com/skiy/p/3766330.html