使用X-SmartToken

好的,因此连接此API的说明如下:

curl -X GET "https://api.xxxxxxxxxxx.com/jobs?limit=10&offset=0" -H "accept: application/json" -H "X-SmartToken: xxxxxxxxxxxxx" 

所以我的PHP如下所示,但是我得到了这个 [message] =>身份验证数据丢失

$token = "xxxxxxxxxxxxx";
$url = "https://api.xxxxxxx.com/jobs?limit=10&offset=0";

header('Content-Type: application/json');
$ch = curl_init($url);
$authorization = "Authorization: X-SmartToken ".$token;
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type: application/json',$authorization ));
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
$result = curl_exec($ch);
curl_close($ch);

print_r(json_decode($result));
exit;

有人看到我在做什么错吗?

谢谢

dlmqwe_a 回答:使用X-SmartToken

$authorization = "X-SmartToken: ".$token;

:丢失,需要删除授权。

,

您不应在HTTP标头前面加上Authorization:

$authorization = "X-SmartToken: " . $token;
本文链接:https://www.f2er.com/3161019.html

大家都在问