How does PHP print out the HTTP request and response headers of the Curl module interaction?

Source: Internet
Author: User
Tags php print

<?PHP//$url = "http://www.baidu.com";$url= "Www.qy.com";$ch= Curl_init ($url); curl_setopt ($ch, Curlopt_header,true);//when enabled, the information for the header file is output as a data stream. curl_setopt ($ch, Curlopt_nobody,true);//when enabled, the body portion of the HTML is not output. curl_setopt ($ch, Curlopt_returntransfer,true);//The information obtained by CURL_EXEC () is returned as a file stream, rather than as a direct output. curl_setopt ($ch, Curlinfo_header_out,true);//the request string to trace the handle when enabled. $response _header= Curl_exec ($ch);//Curl_exec-performing a curl session$meta= Curl_getinfo ($ch);$request _header=$meta[' Request_header '];Var_dump($meta);Var_dump($request _header);Var_dump($response _header);?> requires PHP version greater than 5.1.3

How does PHP print out the HTTP request and response headers of the Curl module interaction?

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.