我要提取我的帐户中的金额,但是找不到帐户错误。我已使用相同的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'
答案 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);
?>