Get owner API issue on server

Unable to get owner details from http://api.hubapi.com/owners/v2/owners/{owner_id} API. We are using personal access token to get owner details from Hubspot. API is working fine for me on my local environment as well as postman. It is not working on server. We are getting below response from owner API
{
“status”: “error”,
“message”: “Any of the listed authentication credentials are missing”,
“correlationId”: “6f08e892-0138-4423-bb78-57235383c2e6”,
“engagement”: {
“vendorkey-gae”: “vendorkey-gae not engaged. Vendorkey not found in request headers.”,
“oauth-token”: “oauth-token not engaged. Malformed OAuth access token found in request header.”,
“service-to-service”: “service-to-service not engaged. Metadata for service-to-service request not found.”,
“hapikey”: “hapikey not engaged. hapikey is not present in query params.”,
“app-cookie”: “app-cookie not engaged. App cookie is not present on the request.”,
“internal-cookie”: “internal-cookie not engaged. Cookie not found in the request.”
}
}
Code snippet is as below:-

<?php

$curl=curl_init();

curl_setopt_array($curl,array(
CURLOPT_URL=>‘http://api.hubapi.com/owners/v2/owners/{owner_id}’,
CURLOPT_RETURNTRANSFER=>true,
CURLOPT_ENCODING=>‘’,
CURLOPT_MAXREDIRS=>10,
CURLOPT_TIMEOUT=>0,
CURLOPT_FOLLOWLOCATION=>true,
CURLOPT_HTTP_VERSION=>CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST=>‘GET’,
CURLOPT_HTTPHEADER=>array(
‘Content-Type:application/json’,
‘Authorization:Bearer pat-XXXXXXX’
),
));

$response=curl_exec($curl);

curl_close($curl);
echo $response;
?>

@lsoftwerks

Hi.

How about this?

(`http` => `https`: Change `CURLOPT_URL`)

$private_app_token = "...";

$curl = curl_init();

$ownerId = '...';

curl_setopt_array($curl, [
 // Both work. API v2, and v3
 //CURLOPT_URL => 'https://api.hubapi.com/owners/v2/owners/' . $ownerId,
 CURLOPT_URL => 'https://api.hubapi.com/crm/v3/owners/' . $ownerId,

 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => '',
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => 'GET',
 CURLOPT_HTTPHEADER => [
 'Content-Type: application/json',
 'Authorization: Bearer ' . $private_app_token,
 ],
]);

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Thanks.