Created
May 19, 2011 22:04
-
-
Save benmcnelly/981895 to your computer and use it in GitHub Desktop.
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 | |
header('Location: http://picreate.com/beeper/notification-sent.html'); | |
// include the PHP TwilioRest library | |
require "twilio/twilio.php"; | |
// twilio REST API version | |
$ApiVersion = "2010-04-01"; | |
// set our AccountSid and AuthToken | |
$AccountSid = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | |
$AuthToken = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; | |
// instantiate a new Twilio Rest Client | |
$client = new TwilioRestClient($AccountSid, $AuthToken); | |
// make an associative array of people we know, indexed by phone number | |
$people = array( | |
"+14175551234"=>"CUSTOMER NAME", | |
); | |
// iterate over all our friends | |
foreach ($people as $number => $name) { | |
// Send a new outgoinging SMS by POSTing to the SMS resource */ | |
$response = $client->request("/$ApiVersion/Accounts/$AccountSid/SMS/Messages", | |
"POST", array( | |
"To" => $number, | |
"From" => "415-XXX-XXXX", | |
"Body" => "Hey $name, your food is ready to be picked up at Caldone's!" | |
)); | |
if($response->IsError) | |
echo "Error: {$response->ErrorMessage}"; | |
else | |
echo "Sent message to $name"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment