Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow specifying a buffer when using Curl::verbose() #250

@zachborboa

Description

@zachborboa

Allow specifying a buffer other than the default STDERR when using Curl::verbose().

Example usage

$buffer = fopen('php://memory', 'w+');

$curl = new Curl();
$curl->setOpt(CURLINFO_HEADER_OUT, false);
$curl->verbose(true, $buffer);
$curl->post('https://httpbin.org/get');

rewind($buffer);
$stderr = stream_get_contents($buffer);
fclose($buffer);
var_dump($stderr);

Implementation

public function verbose($on = true, $output=STDERR)
{
    $this->setOpt(CURLOPT_VERBOSE, $on);
    $this->setOpt(CURLOPT_STDERR, $output);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions