Get the HTTP response headers from the request.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Optional |
A specific header value to return. Defaults to all headers. |
Returns
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
Method defined in lib/requestcore/requestcore.class.php | Toggle source view (8 lines) | View on GitHub