How to Send SMS using Twilio in PHP

In a few lines of code, your PHP application can send, receive, and reply text messages with Twilio Programmable SMS. Download below library file and copy and paste code after setup Account ID, Auth Token and Twilio Number. You may also like How to create text editor in textarea using jquery and Tinymce full featured text editor.

Download Library File

Code

require __DIR__ . '/twilio-php-master/Twilio/autoload.php';
use Twilio\Rest\Client;

$account_sid = '';
$auth_token = '';

$number = '1234567891';
$twilio_number = "+911234567891";
$client = new Client($account_sid, $auth_token);
$client->messages->create(
    '+91'.$number.'',
    array(
        'from' => $twilio_number,
        'body' => 'test message'
    )
);

Leave a Reply

Your email address will not be published. Required fields are marked *