Curl\Curl::verbose PHP Method

verbose() public method

Verbose
public verbose ( boolean $on = true, resource $output = STDERR )
$on boolean
$output resource
    public function verbose($on = true, $output = STDERR)
    {
        // Turn off CURLINFO_HEADER_OUT for verbose to work. This has the side
        // effect of causing Curl::requestHeaders to be empty.
        if ($on) {
            $this->setOpt(CURLINFO_HEADER_OUT, false);
        }
        $this->setOpt(CURLOPT_VERBOSE, $on);
        $this->setOpt(CURLOPT_STDERR, $output);
    }

Usage Example

 public function testAlternativeStandardErrorOutput()
 {
     // Skip test on HHVM due to "Segmentation fault".
     if (defined('HHVM_VERSION')) {
         return;
     }
     $buffer = fopen('php://memory', 'w+');
     $curl = new Curl();
     $curl->verbose(true, $buffer);
     $curl->post(Test::TEST_URL);
     rewind($buffer);
     $stderr = stream_get_contents($buffer);
     fclose($buffer);
     $this->assertNotEmpty($stderr);
 }