protected function prepareHeaders()
    {
        if (!isset($this->headers['Content-Length'])) {

            $content_length = strlen($this->data);

            if ($content_length > 0 || $this->method === 'POST' || $this->method === 'PUT') {
                $this->headers['Content-Length'] = $content_length;
            }
        }

        if (isset($this->uri['user']) && !isset($this->headers['Authorization'])) {
            $pass = isset($this->uri['pass']) ? ':' . $this->uri['pass'] : ':';
            $this->headers['Authorization'] = 'Basic ' . base64_encode($this->uri['user'] . $pass);
        }
    }
protected function prepareHeaders()
    {
        if (!isset($this->headers['Content-Length'])) {

            $content_length = strlen($this->data);

            if ($content_length > 0 || $this->method === 'POST' || $this->method === 'PUT') {
                $this->headers['Content-Length'] = $content_length;
            }
        }

        if (isset($this->uri['user']) && !isset($this->headers['Authorization'])) {
            $pass = isset($this->uri['pass']) ? ':' . $this->uri['pass'] : ':';
            $this->headers['Authorization'] = 'Basic ' . base64_encode($this->uri['user'] . $pass);
        }
    }
protected function prepareHeaders ( ) { if ( ! isset ( $ this -> headers [ 'Content-Length' ] ) ) { $ content_length = strlen ( $ this -> data ) ; if ( $ content_length > 0 || $ this -> method === 'POST' || $ this -> method === 'PUT' ) { $ this -> headers [ 'Content-Length' ] = $ content_length ; } } if ( isset ( $ this -> uri [ 'user' ] ) && ! isset ( $ this -> headers [ 'Authorization' ] ) ) { $ pass = isset ( $ this -> uri [ 'pass' ] ) ? ':' . $ this -> uri [ 'pass' ] : ':' ; $ this -> headers [ 'Authorization' ] = 'Basic ' . base64_encode ( $ this -> uri [ 'user' ] . $ pass ) ; } }
Prepare request headers
Prepare request headers