PHP CURL analog POST submission data

Source: Internet
Author: User
Tags curl
PHP CURL Analog POST submission data:
function Liansuo_post ($url, $data) {//Analog submit data functions            $curl = Curl_ Init (); Start a Curl session           curl_setopt ($curl, Curlopt_url, $url); Address to access                       curl_setopt ($curl, Curlopt_ssl_verifypeer, 0); Inspection of the source of the certificate           curl_setopt ($curl, Curlopt_ssl_verifyhost, 1); Check the SSL encryption algorithm exists from the certificate           curl_setopt ($curl, Curlopt_useragent, $ _server[' http_user_agent ']); Simulated user-used browsers          curl_setopt ($curl, curlopt_followlocation, 1); Use automatic jump           curl_setopt ($curl, Curlopt_autoreferer, 1); Automatically set Referer           curl_setopt ($curl, Curlopt_post, 1); Send a regular POST request           curl_setopt ($curl, Curlopt_postfields, $ data); Post-Submitted packets           curl_setopt ($curl, Curlopt_cookiefile, $ globals[' Cookie_file ']); Read the cookie information stored above           curl_setopt ($curl, Curlopt_timeout, 30); Set timeout limit to prevent dead loops           curl_setopt ($curl, Curlopt_header, 0); Displays the header area returned           curl_setopt ($curl, Curlopt_ Returntransfer, 1); The information obtained is returned in the form of a file stream            $tmpInfo = curl_exec ($curl); Execute action           if (Curl_errno ($curl)) {              echo ' Errno '. Curl_error ($curl);           }         &nbsP; curl_close ($curl); Key Curl session           return $tmpInfo; Return Data      }     tested pass, leave a thought for yourself, not sure which day to use. This article turns from: http://blog.sina.com.cn/s/blog_6c96939d0102e1to.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.