I am trying to hit a CURL "GET" request in php but getting the error as "Authentication credentials were not provided". So I cannot understand for which exact reason, the error is showing. Can anyone help?
$api_token = "test";
$question_id = "test1";
$organization_id = "test2";
$thumbnail_file_path = "";
$request_headers=array();
$request_headers[]='Authorization: f'.$api_token;
$request_headers[]='Content-Type: application/json';
$request_headers[]='organization_id:'.$organization_id;
$url="https//www.xyz.com/{$question_id}";
// return $payloadName;
$process = curl_init();
curl_setopt($process, CURLOPT_HTTPHEADER, $request_headers);
curl_setopt($process, CURLOPT_URL,$url);
curl_setopt($process, CURLOPT_RETURNTRANSFER,true);
curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$output = curl_exec($process);
echo $output;
$err = curl_error($process);
// get info about the request
$info = curl_getinfo($process);
print_r($info);
curl_close($process);
CodePudding user response:
Are you sure f
in Authorization
header is necessary? Looks like a typo