Php – How to view PHP cURL request body (like CURLINFO_HEADER_OUT for headers)

curlPHP

I can view the headers of a request sent using php curl with the following:

curl_getinfo($ch, CURLINFO_HEADER_OUT);

I wish to see the body of what is being sent out as well but cannot for the life of me find any way to do so.

Best Answer

I was unable to find any such option after extensively searching the PHP cURL documentation.

My solution was to use the web proxy tool Charles

Charles is an HTTP proxy / HTTP monitor / Reverse Proxy that enables a developer to view all of the HTTP and SSL / HTTPS traffic between their machine and the Internet. This includes requests, responses and the HTTP headers (which contain the cookies and caching information).