OSS\Http\RequestCore::get_response_header PHP Method

get_response_header() public method

Get the HTTP response headers from the request.
public get_response_header ( string $header = null ) : string | array
$header string (Optional) A specific header value to return. Defaults to all headers.
return string | array All or selected header values.
    public function get_response_header($header = null)
    {
        if ($header) {
            return $this->response_headers[strtolower($header)];
        }
        return $this->response_headers;
    }

Usage Example

 public function testGetParseTrue()
 {
     $httpCore = new RequestCore("http://www.baidu.com");
     $httpCore->curlopts = array(CURLOPT_HEADER => true);
     $url = $httpCore->send_request(true);
     foreach ($httpCore->get_response_header() as $key => $value) {
         $this->assertEquals($httpCore->get_response_header($key), $value);
     }
     $this->assertNotNull($url);
 }
All Usage Examples Of OSS\Http\RequestCore::get_response_header