Skip to content

Console output * Closing connection 0 #596

@ABC333Love

Description

@ABC333Love
$this->setOpt(CURLINFO_HEADER_OUT, true);

This code causes the php-cli mode console to output a lot of useless information,
such as * Closing connection 0

curl-err

Add the following code to avoid output

$this->setOpt(CURLOPT_VERBOSE, 0); //set verbose mode off

Modify code Curl\Curl::initialize

    /**
     * Initialize
     *
     * @access public
     * @param  $base_url
     */
    public function initialize($base_url = null)
    {
        $this->id = uniqid('', true);
        $this->setDefaultUserAgent();
        $this->setDefaultTimeout();
        $this->setOpt(CURLINFO_HEADER_OUT, true);
        $this->setOpt(CURLOPT_VERBOSE, 0); //set verbose mode off

        // Create a placeholder to temporarily store the header callback data.
        $header_callback_data = new \stdClass();
        $header_callback_data->rawResponseHeaders = '';
        $header_callback_data->responseCookies = array();
        $this->headerCallbackData = $header_callback_data;
        $this->setOpt(CURLOPT_HEADERFUNCTION, createHeaderCallback($header_callback_data));

        $this->setOpt(CURLOPT_RETURNTRANSFER, true);
        $this->headers = new CaseInsensitiveArray();
        $this->setUrl($base_url);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions