Skip to content
Advertisement

PHP – Debugging Curl

I’d like to see what the post fields in the request are before I send it. (For debugging purposes).

The PHP library (class) I am using is already made (not by me), so I am trying to understand it.

As far as I can tell, it uses curl_setopt() to set different options like headers and such and then it uses curl_exec() to send the request.

Ideas on how to see what post fields are being sent?

Advertisement

Answer

You can enable the CURLOPT_VERBOSE option:

curl_setopt($curlhandle, CURLOPT_VERBOSE, true);

When CURLOPT_VERBOSE is set, output is written to STDERR or the file specified using CURLOPT_STDERR. The output is very informative.

You can also use tcpdump or wireshark to watch the network traffic.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement