See what CURL sends from a PHP script See what CURL sends from a PHP script curl curl

See what CURL sends from a PHP script


Thanks for all the answers! After all, they tell that It's not possible. I went down the road and got familiar with Wireshark. Not an easy task but definitely worth the effort.


Have you tried CURLINFO_HEADER_OUT?

Quoting the PHP manual for curl_getinfo:

CURLINFO_HEADER_OUT - The request string sent. For this to work, add the CURLINFO_HEADER_OUT option to the handle by calling curl_setopt()


If you are wanting the content can't you just log it? I am doing something similar for my API calls

$ch = curl_init();curl_setopt($ch, CURLOPT_URL, self::$apiURL);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);curl_setopt($ch, CURLOPT_POST, count($dataArray));curl_setopt($ch, CURLOPT_POSTFIELDS, $dataString);$logger->info("Sending " . $dataString);self::$results = curl_exec($ch);curl_close($ch);$decoded = json_decode(self::$results);$logger->debug("Received " . serialize($decoded));

Or try

curl_setopt($ch, CURLOPT_STDERR, $fp);