您好我必须在我的应用中验证用户电话号码 . 我已经实现了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}";
From: 当我点击 Get your first twilio phone number
时,他们给了我一个我在“发件人”字段中使用过的美国手机号码
To: 这里我使用了自己的号码,以便我可以收到文本 . 我的号码在twilio中也用于验证目的
我基本上想用twilio从像“6323”这样的数字发送随机密码 . 请告诉我我错过了什么 . 而且他们也给了我在From字段中使用的美国号码 . 如何在“发件人”字段中获取“6323”等短号或“whatsapp”等字母名称 .
1 回答
根据docs:
所以你需要将
+15005550006
硬编码为From
.有关其API的更多信息,请参阅this