短信tm4b帐户余额请求

时间:2020-09-27 15:15:04

标签: php api sms

我正在使用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()在

$responseAccount = $msgClient->account();

1 个答案:

答案 0 :(得分:0)

https://github.com/tm4b/tm4b-php(我假设您正在使用)的文档中,您似乎应该做$responseAccount = $msgClient->account()->describe();而不是$responseAccount = $msgClient->account();