Last active
January 4, 2016 05:49
-
-
Save emilstahl/8577967 to your computer and use it in GitHub Desktop.
Send Twillio SMS command line promoting for name, number and message.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Step 1: Download the Twilio-PHP library from twilio.com/docs/libraries, | |
// and move it into the folder containing this file. | |
require "Services/Twilio.php"; | |
// Step 2: set our AccountSid and AuthToken from www.twilio.com/user/account | |
$accountSid = 'xx'; | |
$authToken = 'yy'; | |
// Step 3: instantiate a new Twilio Rest Client | |
$client = new Services_Twilio($accountSid, $authToken); | |
$number = readline("Number: "); | |
$message = readline("Message: "); | |
$sms = $client->account->messages->sendMessage( | |
// Step 6: Change the 'From' number below to be a valid Twilio number | |
// that you've purchased, or the (deprecated) Sandbox number | |
"zz", $number, $message | |
); | |
// Display a confirmation message on the screen | |
echo "Message sent to $number\n"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment