Adds a custom HTTP header to the cURL request.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
|
Required |
The custom HTTP header to set. |
|
|
|
Required |
The value to assign to the custom HTTP header. |
Returns
Type |
Description |
|---|---|
|
A reference to the current instance. |
Examples
Add a custom header to the request (without firing it).
$http = new RequestCore('http://github.com/skyzyx/requestcore/raw/master/_tests/test_request.txt');
$http->prep_request();
$http->add_header('x-requestcore-header', 'value');
var_dump($http->request_headers);
Result:
array(3) {
["Expect"]=>
string(12) "100-continue"
["Connection"]=>
string(5) "close"
["x-requestcore-header"]=>
string(5) "value"
}
Source
Method defined in lib/requestcore/requestcore.class.php | Toggle source view (5 lines) | View on GitHub

