短信tm4b账户余额请求
sms tm4b account balance request
我正在使用 tm4b 发送短信。使用此代码一切正常 (https://www.tm4b.com/en/sms-api/)
$msgClient = \Tm4b\Rest\Client::create([
'apiKey' => 'xxx'
]);
try {
$response = $msgClient->messages()->send([
[
'destination_address' => '+33611111111',
'source_address' => 'TEST',
'content' => "Hello"
]
]);
print_r($response);
} catch (\Tm4b\Exception\HttpClientException $e) {
print_r($e->getResponseBody());
}
但是你如何申请账户余额?我试过了(不工作)。我应该得到我剩下的发送短信的信用额度。致命错误:未捕获错误:调用未定义的方法 Tm4b\Rest\Client::account() in
$responseAccount = $msgClient->account();
根据 https://github.com/tm4b/tm4b-php 的文档(我假设您正在使用),您似乎应该使用 $responseAccount = $msgClient->account()->describe();
而不是 $responseAccount = $msgClient->account();
我正在使用 tm4b 发送短信。使用此代码一切正常 (https://www.tm4b.com/en/sms-api/)
$msgClient = \Tm4b\Rest\Client::create([
'apiKey' => 'xxx'
]);
try {
$response = $msgClient->messages()->send([
[
'destination_address' => '+33611111111',
'source_address' => 'TEST',
'content' => "Hello"
]
]);
print_r($response);
} catch (\Tm4b\Exception\HttpClientException $e) {
print_r($e->getResponseBody());
}
但是你如何申请账户余额?我试过了(不工作)。我应该得到我剩下的发送短信的信用额度。致命错误:未捕获错误:调用未定义的方法 Tm4b\Rest\Client::account() in
$responseAccount = $msgClient->account();
根据 https://github.com/tm4b/tm4b-php 的文档(我假设您正在使用),您似乎应该使用 $responseAccount = $msgClient->account()->describe();
而不是 $responseAccount = $msgClient->account();