curl_setopt($handle, CURLOPT_VERBOSE, true);
$verbose = fopen('php://temp', 'w+');
curl_setopt($handle, CURLOPT_STDERR, $verbose);
$result = curl_exec($handle);
if ($result === FALSE) {
printf("cUrl error (#%d): %s<br>
", curl_errno($handle),
htmlspecialchars(curl_error($handle)));
}
rewind($verbose);
$verboseLog = stream_get_contents($verbose);
echo "Verbose information:
<pre>", htmlspecialchars($verboseLog), "</pre>
";