twilio从数量要求

时间:2014-06-09 14:04:35

标签: php twilio

尝试使用twilio做最基本的功能,我遇到了一个问题。它想要一个来自数字,即使我已经提供了它。有什么想法吗?

<?php
require_once('Services/Twilio.php');

$twilioNumber = "someValidNumber";
$dest = "SomeValidDestination";

$AccountSid = "ValidSid";
$AuthToken = "ValidToken";

$client = new Services_Twilio($AccountSid, $AuthToken);

try {
    $message = $client->account->messages->create(
    $twilioNumber,
    $dest,
    "Hello World!");

} catch (Services_Twilio_RestException $e) {
echo $e->getMessage();
}

&GT;

结果:

PHP Warning:  Invalid argument supplied for foreach() in /var/www/html/sms/Services/Twilio.php on line 248
A 'From' phone number is required.

1 个答案:

答案 0 :(得分:1)

文档有点误导。改变

account->messages->create

account->messages->sendMessage

它工作正常。