【发布时间】:2016-03-18 13:46:06
【问题描述】:
您好,我必须在我的应用中验证用户电话号码。我已经实现了 twilio 库,但我无法发送短信。我收到此错误
Uncaught exception 'Services_Twilio_RestException' with message 'The From phone number +120xxxxxxx is not a valid, SMS-capable inbound phone number or short code for your account
我还没有购买他们的订阅。我想先测试他们的服务,所以我使用的是试用帐户。我使用了 test AccountSID 和 Test authToken 。
<?php
require "twilio/Services/Twilio.php";
// set your AccountSid and AuthToken from www.twilio.com/user/account
$AccountSid = "testaccountsid";
$AuthToken = "testauthtoken";
$client = new Services_Twilio($AccountSid, $AuthToken);
$message = $client->account->messages->create(array(
"From" => "+1xxxxxxxx",
"To" => "+92xxxxxxx",
"Body" => "Test message!",
));
// Display a confirmation message on the screen
echo "Sent message {$message->sid}";
发件人:当我点击Get your first twilio phone number时,他们给了我一个我在发件人字段中使用的美国手机号码
收件人:这里我使用了自己的号码,以便接收短信。我自己的号码在 twilio 中也用于验证目的
我基本上想使用 twilio 从“6323”之类的数字发送随机密码。请告诉我我错过了什么。他们还给了我在 From 字段中使用的美国号码。如何在 From 字段中获取“6323”之类的短数字或“whatsapp”之类的字母名称。
【问题讨论】:
标签: php twilio twilio-php