private function parseHeaders($headers)
    {
        $headers_temp = array();

        $requests = explode("\r\n\r\n", $headers);
        // follow eventual redirections
        for ($index = 0; $index < count($requests) - 1; $index++) {

            foreach (explode("\r\n", $requests[$index]) as $i => $line) {
                if ($i === 0)
                    continue;
                list($key, $value) = explode(': ', $line);
                $headers_temp[$index][$key] = $value;
            }
        }
        // gets always the latest response
        $this->headers = end($headers_temp) !== false ? end($headers_temp) : [];
    }
private function parseHeaders($headers)
    {
        $headers_temp = array();

        $requests = explode("\r\n\r\n", $headers);
        // follow eventual redirections
        for ($index = 0; $index < count($requests) - 1; $index++) {

            foreach (explode("\r\n", $requests[$index]) as $i => $line) {
                if ($i === 0)
                    continue;
                list($key, $value) = explode(': ', $line);
                $headers_temp[$index][$key] = $value;
            }
        }
        // gets always the latest response
        $this->headers = end($headers_temp) !== false ? end($headers_temp) : [];
    }
private function parseHeaders ( $ headers ) { $ headers_temp = array ( ) ; $ requests = explode ( "\r\n\r\n" , $ headers ) ; // follow eventual redirections for ( $ index = 0 ; $ index < count ( $ requests ) - 1 ; $ index ++ ) { foreach ( explode ( "\r\n" , $ requests [ $ index ] ) as $ i => $ line ) { if ( $ i === 0 ) continue ; list ( $ key , $ value ) = explode ( ': ' , $ line ) ; $ headers_temp [ $ index ] [ $ key ] = $ value ; } } // gets always the latest response $ this -> headers = end ( $ headers_temp ) !== false ? end ( $ headers_temp ) : [ ] ; }
Parses headers to an array
@param $headers
Parses headers to an array