get_response_header ( $header )

Get the HTTP response headers from the request.

Access

public

Parameters

Parameter

Type

Required

Description

$header

string

Optional

A specific header value to return. Defaults to all headers.

Returns

Type

Description

string
array

All or selected header values.

Examples

Display the Content-Type header of the response.

$http = new RequestCore('http://github.com/skyzyx/requestcore/raw/master/_tests/test_request.txt');
$http->send_request();

var_dump($http->get_response_header('content-type'));
Result:
string(25) "text/plain; charset=utf-8"

Display the URL that was requested.

$http = new RequestCore('http://github.com/skyzyx/requestcore/raw/master/_tests/test_request.txt');
$http->send_request();
$info = $http->get_response_header('_info');

var_dump($info['url']);
Result:
string(71) "http://github.com/skyzyx/requestcore/raw/master/_tests/test_request.txt"

Source

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback