Show Curl POST Request Headers? Is there a way to do this? Show Curl POST Request Headers? Is there a way to do this? curl curl

Show Curl POST Request Headers? Is there a way to do this?


Here is all you need:

curl_setopt($curlHandle, CURLINFO_HEADER_OUT, true); // enable tracking... // do curl request    $headerSent = curl_getinfo($curlHandle, CURLINFO_HEADER_OUT ); // request headers


You can see the information regarding the transfer by doing:

curl_setopt($curl_exect, CURLINFO_HEADER_OUT, true);

before the request, and

$information = curl_getinfo($curl_exect);

after the request

View: http://www.php.net/manual/en/function.curl-getinfo.php

You can also use the CURLOPT_HEADER in your curl_setopt

curl_setopt($curl_exect, CURLOPT_HEADER, true);$httpcode = curl_getinfo($c, CURLINFO_HTTP_CODE);return $httpcode == 200;

These are just some methods of using the headers.


You can save all headers sent by curl to a file using :

$f = fopen('request.txt', 'w');curl_setopt($ch,CURLOPT_VERBOSE,true);curl_setopt($ch,CURLOPT_STDERR ,$f);