Clickatell获得平衡

时间:2018-11-20 08:05:31

标签: php http clickatell

我要提取我的帐户中的金额,但是找不到帐户错误。我已使用相同的API成功发送短信。

<?php

$authToken = "myapi";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://platform.clickatell.com/public-client/balance");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "X-Version: 1",
    "Accept: application/json",
    "Authorization: Bearer $authToken"
));

echo $result = curl_exec ($ch);

?>

他们想要这样 curl -X GET --header'Accept:application / json'--header'Authorization:您的API密钥''https://platform.clickatell.com/public-client/balance'

1 个答案:

答案 0 :(得分:0)

Clickatell未使用OAuth2进行授权,因此只需从授权中删除“承载者”即可。所以它应该像这样:

<?php

$authToken = "myapi";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://platform.clickatell.com/public-client/balance");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    "X-Version: 1",
    "Accept: application/json",
    "Authorization: $authToken"
));

echo $result = curl_exec ($ch);

?>