Created
June 24, 2012 19:39
-
-
Save RobSpectre/2984633 to your computer and use it in GitHub Desktop.
Let users post ads via SMS and forward to ad network manager
This file contains hidden or 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('Content-type: text/xml'); | |
// Set your account credentials and numbers you want to call and text. | |
$ACCOUNT_SID = "ACxxxxxxxxx"; | |
$AUTH_TOKEN = "yyyyyyyyyyyy"; | |
$TWILIO_NUMBER = "+12223334444"; | |
$NUMBER_TO_TEXT = "+15554443333"; | |
// Include Twilio PHP helper library | |
require_once('Services/Twilio.php'); | |
$from = $_REQUEST['From']; | |
$from_city = $_REQUEST['FromCity']; | |
$from_state = $_REQUEST['FromState']; | |
$body = $_REQUEST['Body']; | |
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN); | |
$message = $client->account->sms_messages->create( | |
$TWILIO_NUMBER, | |
$NUMBER_TO_TEXT, | |
"New ad: ".$from.", ".$from_city.", ".$from_state.": ".$body | |
); | |
?> | |
<Response> | |
<Sms>We have your ad.</Sms> | |
</Response> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment