I have implemented test twilio sms application. I have downloaded three files from https://github.com/benedmunds/CodeIgniter-Twilio
I have used my account_sid, auth_token in twilio.php file which is in config folder. I have also used 'from' number as +15005550006 in that file.
I have used following codes in my controller
<?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';
}
}
Now when I run the controller file in the browser(not in my machine but in server), it runs successfully and it shows "Sent message".
But no sms is received. Please help.
My name is Jarod and I work at Twilio. There are multiple reasons this could be failing so lets walk through them one at a time.
1. Sending an sms using Twilio test credentials will not result in an sms being sent.
Test credentials are used for testing and debugging your application. They are "fake" numbers, that do not send any data via carrier, but instead return preset error codes and responses in order to test response-handling in your application. As you experienced this specific test credential +15005550006 will always return NO ERROR, whereas +15005550001 will always respond with "This phone number is invalid".
2. You can only send SMS from a Twilio number or a verified phone number.
You can always send an SMS from a number you bought on Twilio.com, but in order to send an SMS from any other number you must first verify that phone number with Twilio. Read more about the difference here.
These are the most common reasons for not receiving and actual SMS but in the case of the Indian phone numbers it could very well be one of these rare limitations.
If none of these work we probably need to look into your specific account to find out what's happening, in which case you should reach out to [email protected].
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With