proxylib.php
protected function _buildResponseHeaderFromMeta($meta)
    {
        if(! array_key_exists('wrapper_data', $meta))
            throw new Exception("Did not receive a valid response from the server");

        $headers = $meta['wrapper_data'];

        /**
         * When using stream_context_create, if the socket is redirected via a
         *  302, PHP just adds the 302 headers onto the wrapper_data array
         *  in addition to the headers from the redirected page. We only
         *  want the redirected page's headers.
         */
        $last_status = 0;
        for($i = 0; $i < count($headers); $i++)
        {
            if(strpos($headers[$i], 'HTTP/') === 0)
            {
                $last_status = $i;
            }
        }

        # Get the applicable portion of the headers
        $headers = array_slice($headers, $last_status);

        return implode("\n", $headers);
    }
protected function _buildResponseHeaderFromMeta($meta)
    {
        if(! array_key_exists('wrapper_data', $meta))
            throw new Exception("Did not receive a valid response from the server");

        $headers = $meta['wrapper_data'];

        /**
         * When using stream_context_create, if the socket is redirected via a
         *  302, PHP just adds the 302 headers onto the wrapper_data array
         *  in addition to the headers from the redirected page. We only
         *  want the redirected page's headers.
         */
        $last_status = 0;
        for($i = 0; $i < count($headers); $i++)
        {
            if(strpos($headers[$i], 'HTTP/') === 0)
            {
                $last_status = $i;
            }
        }

        # Get the applicable portion of the headers
        $headers = array_slice($headers, $last_status);

        return implode("\n", $headers);
    }
protected function _buildResponseHeaderFromMeta ( $ meta ) { if ( ! array_key_exists ( 'wrapper_data' , $ meta ) ) throw new Exception ( "Did not receive a valid response from the server" ) ; $ headers = $ meta [ 'wrapper_data' ] ; /**
         * When using stream_context_create, if the socket is redirected via a
         *  302, PHP just adds the 302 headers onto the wrapper_data array
         *  in addition to the headers from the redirected page. We only
         *  want the redirected page's headers.
         */ $ last_status = 0 ; for ( $ i = 0 ; $ i < count ( $ headers ) ; $ i ++ ) { if ( strpos ( $ headers [ $ i ] , 'HTTP/' ) === 0 ) { $ last_status = $ i ; } } # Get the applicable portion of the headers
 $ headers = array_slice ( $ headers , $ last_status ) ; return implode ( "\n" , $ headers ) ; }
Given an associative array returned by PHP's methods to get stream meta,
extract the HTTP response header from it
@param array $meta The associative array contianing stream information
@return array
Given an associative array returned by PHP s methods to get stream meta extract the HTTP response header from it