Follow Authorization header - Question

Hi Team,

I’m happy if you help me here. I’m just trying to get code in PHP(curl). But the issue is how to " Retain authorization header when a redirect happens to a different hostname. " But no changes are done when I’m coping PHP code of my request. How to code that in the PHP curl file.

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => “https://resmed-agm--sit.cs37.my.salesforce.com/services/apexrest/api/hubspot/v1/HubspotAPI_SleepQuiz”,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => “”,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => “POST”,
CURLOPT_POSTFIELDS =>"{\n “email”: “testsalesapi@gmail.com”,\n “name”: “Shivasagar”,\n “phone”: “8861760420”}",
CURLOPT_HTTPHEADER => array(
“Authorization: OAuth access_token”,
“Content-Type: application/json”,
“Cookie: BrowserId=KnNiRKC5EeqFJ0UJd0AmeQ”
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;