php-rest-curl icon indicating copy to clipboard operation
php-rest-curl copied to clipboard

Add custom header

Open juancarielo opened this issue 9 years ago • 0 comments

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);

juancarielo avatar Sep 15 '16 19:09 juancarielo