你好,我必须验证我的应用程序中的用户电话号码。我已经实施twilio库,但我无法发送短信。我得到这个错误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
我还没有买他们的订阅呢。我想先测试他们的服务,以便使用试用帐户。我已经使用测试AccountSID
和测试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”或类似这样的数字的随机PIN码。请告诉我我错过了什么。而且他们也给我美国号码,我在From字段中使用。如何在From字段中获得像“6323”这样的短号码或“whatsapp”这样的字母名称。
这是绝对正确的。只需添加它,当您尚未使用信用卡升级您的帐户时,您可以使用Live Credentials将SMS消息发送到您自己的电话号码,并且不会花费任何费用。 – philnash
@AlexTartan感谢alex的答案。好吧现在它的工作,它说发送消息。但我的手机上没有收到任何短信。 – user1hjgjhgjhggjhg