Clickatell Get Balance

294 Views Asked by At

I want to withdraw the amount in my account, but the account is not found error. I'm successfully sending sms with the same 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);

?>

They want like this curl -X GET --header 'Accept: application/json' --header 'Authorization: Your API key' 'https://platform.clickatell.com/public-client/balance'

1

There are 1 best solutions below

0
On

Clickatell is not using OAuth2 for authorization, so just remove the "Bearer" from the Authorization. So it should look like this:

<?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);

?>