Data is directly obtained through curl, simulated login, and POST data.

Source: Internet
Author: User

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

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.