php-rest-curl
php-rest-curl copied to clipboard
Add custom header
Add custom header and relateds, example code:
// Array $http_header data default
$headerDataDefault = array('Accept: application/json', 'Content-Type: application/json');
// Check headerData
if (!empty($headerData)) {
$headerDataDefault = array_merge($headerDataDefault, $headerData);
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $headerDataDefault);
Send custom header:
// $headerData = array('Authorization: HASH_AUTHORIZATION')
RestCurl::exec("GET", $url, $headerData, $obj);