How to send sms using twillo

1.Login buy a local number

2. update your account and load some money into your account

3. get credential

4.Download the package : https://github.com/twilio/twilio-php/archive/master.zip

5. Now unizip the folder and write the following code:

 

require __DIR__ . ‘/twilio-php-master/Twilio/autoload.php’;

// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;

// Your Account SID and Auth Token from twilio.com/console
$sid = ‘your_account_id’;
$token = ‘your_token’;
$client = new Client($sid, $token);

// Use the client to do fun stuff like send text messages!
$client->messages->create(
// the number you’d like to send the message to
’90xxxxxx’,
array(
// A Twilio phone number you purchased at twilio.com/console
‘from’ => ‘+190xxxxxx’,
// the body of the text message you’d like to send
‘body’ => “Hey Jenny! Good luck on the bar exam!”
)
);

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s