Getting data directly through curl, simulating login, POST data _ PHP Tutorial

Source: Internet
Author: User
Data is directly obtained through curl, simulated login, and POST data. The Markdown editor of the blog park is too boring @!!! Forget it. No format !!! ********************** Curl series **************** * ****** it is too difficult to directly use curl to obtain the Markdown editor of the data blog Park @!!! 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

SUCCESS @!!! Forget it. No format !!! /********************** Curl series *************** * ******* // Obtain data directly through curl...

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.