PHP Curl 用于测试 Sabre RESTful API 身份验证失败


PHP Curl to test Sabre RESTful API Authentication Failing

我已经成功地连接到Sabre的RESTful API,并使用我的测试密钥/秘密获取我的身份验证令牌。然而,下一步我正在努力 - 我是新手卷曲,所以请原谅我的无知。有人可以告诉我哪里出错了吗?

$key是我的 Sabre 生成的身份验证令牌

$url = "https://api.test.sabre.com/v2/shop/flights/fares?origin=ATL&destination=LAS&departuredate=2016-06-30&lengthofstay=3,4,5,6,7&maxfare=250";
$header[] = "Authorization: Bearer " . $key;
$header[] = "Accept: application/json";
//should use http 1.1 by default
//uses GET by default
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
$content = curl_exec($ch);
curl_close($ch);
var_dump(json_decode($content));

我认为这可能是错误的网址。我没有生产 API 密钥,只有一个测试密钥。但是,将网址更改为生产网址(删除测试)并没有什么区别。

这是来自 Sabre 的错误

object(stdClass)[2]
public 'status' => string 'NotProcessed' (length=12)
public 'type' => string 'Validation' (length=10)
public 'errorCode' => string 'ERR.2SG.SEC.MISSING_CREDENTIALS' (length=31)
public 'timeStamp' => string '2016-03-10T01:17:19.556-06:00' (length=29)
public 'message' => string 'Authentication data is missing' (length=30)`

我以某种方式搞砸了我的标题吗?

在此步骤4中:https://developer.sabre.com/docs/read/rest_basics/authentication 它说标头应该是

授权:持有者{您的令牌}

感谢您的帮助!

我是个白痴。我没有破坏我以前的$header变量。