Show curl transfer request headers in PHP

By | July 14, 2015

Show curl transfer request headers in PHP

While using curl method to connect with some web services we need to send headers in some specified formats. In some cases a unformed headers will produce some issues. But we don’t know whether the headers we sent is formed correct or not. To know the transfer request details we sent using curl we have curl_getinfo function.

curl_getinfo – Get information regarding a specific transfer

You can read more about the curl_getinfo function here

To know the transfer request headers we have to set below parameter to true.

CURLINFO_HEADER_OUT – The request string sent.

curl_setopt($curlHandle, CURLINFO_HEADER_OUT, true); // enable to tract transfer request

$headerSent = curl_getinfo($curlHandle, CURLINFO_HEADER_OUT ); // request headers

When printing the $headerSent variable you will have the details of curl transfer request.

🔥0

One thought on “Show curl transfer request headers in PHP

  1. Williammi

    Really appreciate you sharing this post.Really looking forward to read more. Eichenauer

    Reply

Leave a Reply