I'm trying to get some data with API from ssactivewear.com (https://api.ssactivewear.com/V2/products)
I have used this code
$username = 'XXXXXXXX';
$password = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,https://api.ssactivewear.com/v2/products);
$headers = array(
'Content-Type: application/json'
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 40);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");
curl_setopt($ch, CURLOPT_COOKIESESSION, true);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$result = curl_error($ch);
} else {
$result = $result;
}
curl_close($ch);
But I got below mention result
"{ "message": "Authorization has been denied for this request." }"
Any help or support may solve my issue?