我已经实现了测试 twilio 短信应用程序。我从https://github.com/benedmunds/CodeIgniter-Twilio下载了三个文件
我在 config 文件夹中的 twilio.php 文件中使用了我的 account_sid、auth_token。我还在该文件中使用了“来自”号码作为 +15005550006。
我在控制器中使用了以下代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Twiliosms extends TL_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
$this->load->library('twilio');
$from = '+15005550006';
$to = '+91xxxxxxxxxx';
$message = 'This is a test...';
$response = $this->twilio->sms($from, $to, $message);
//echo "<pre>";print_r($response);echo "</pre>";
if($response->IsError)
echo 'Error: ' . $response->ErrorMessage;
else
//echo 'Sent message to ' . $to;
echo 'Sent message';
}
}
现在,当我在浏览器中运行控制器文件(不是在我的机器中,而是在服务器中)时,它运行成功并显示“已发送消息”。
但是没有收到短信。请帮忙。