private function parse($headers)
    {
        foreach (preg_split('/\r\n|\r|\n/', $headers) as $i => $line) {
            if ($i === 0) {
                $this->headers['http_code'] = $line;
            } else {
                list($key, $value) = explode(': ', $line);

                if ($key === 'Set-Cookie') {
                    list($textCookie) = explode(';', $value);
                    list($cookieKey, $cookieValue) = explode('=', $textCookie);

                    $this->cookies[$cookieKey] = $cookieValue;
                } else {
                    $this->headers[$key] = $value;
                }
            }
        }
    }
private function parse($headers)
    {
        foreach (preg_split('/\r\n|\r|\n/', $headers) as $i => $line) {
            if ($i === 0) {
                $this->headers['http_code'] = $line;
            } else {
                list($key, $value) = explode(': ', $line);

                if ($key === 'Set-Cookie') {
                    list($textCookie) = explode(';', $value);
                    list($cookieKey, $cookieValue) = explode('=', $textCookie);

                    $this->cookies[$cookieKey] = $cookieValue;
                } else {
                    $this->headers[$key] = $value;
                }
            }
        }
    }
private function parse ( $ headers ) { foreach ( preg_split ( '/\r\n|\r|\n/' , $ headers ) as $ i => $ line ) { if ( $ i === 0 ) { $ this -> headers [ 'http_code' ] = $ line ; } else { list ( $ key , $ value ) = explode ( ': ' , $ line ) ; if ( $ key === 'Set-Cookie' ) { list ( $ textCookie ) = explode ( ';' , $ value ) ; list ( $ cookieKey , $ cookieValue ) = explode ( '=' , $ textCookie ) ; $ this -> cookies [ $ cookieKey ] = $ cookieValue ; } else { $ this -> headers [ $ key ] = $ value ; } } } }
Parse text headers and fills in cookies and headers properites

@param string $headers
Parse text headers and fills in cookies and headers properites