我试图使用PHP对GetReponse进行简单的CURL调用,我肯定做错了什么。每次我尝试使用我的客户端访问令牌时,它都会爆炸。如果我硬编码我的公司API密钥到我放置xxxxx的地方,它可以正常工作。我在用他们的文件,但我不能让它起作用,有帮助吗?顺便说一句,他们的医生太可怕了--太糟糕了,我甚至无法充分解释!里面满是十亿个字.他们的医生
$url = "https://api.getresponse.com/v3/campaigns";
$headers = array();
$headers[] = "X-Auth-Token: api-key xxxxxxxxx";
$state_ch = curl_init();
curl_setopt($state_ch, CURLOPT_URL, $url);
curl_setopt($state_ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($state_ch, CURLOPT_HTTPHEADER, $headers);
$state_result = curl_exec ($state_ch);
$state_result = json_decode($state_result);
$debug = 1;
print_r($state_result);我总是得到同样的回应:
stdClass Object
(
[httpStatus] => 401
[code] => 1014
[codeDescription] => Problem during authentication process, check headers!
[message] => Unable to authenticate request. Check credentials or authentication method details
[moreInfo] => https://apidocs.getresponse.com/en/v3/errors/1014
[context] => stdClass Object
(
[authenticationType] => auth_token
)
[uuid] => xxxxxxxxxxxxxxxxxxxxxxxxx
)同样,如果我把我的公司API密钥放在xxxxxx的位置(我必须进入他们的控制面板),它就能工作。访问令牌没有。
解决方案:
看起来头需要换到这个..。
$headers[] = "Authorization: Bearer xxxxxxxxxxxxxxx"发布于 2017-03-07 02:03:07
如我所见:
httpStatus401 =未经授权
检查您的API令牌权限
https://stackoverflow.com/questions/42638041
复制相似问题