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 | |
require_once('Services/Twilio.php'); | |
require_once('auth.php'); | |
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN); | |
$list = $client->account->available_phone_numbers->getList('US', 'TollFree'); | |
foreach ($list->available_phone_numbers as $num) { | |
print_r($num); |
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 | |
if (isset($_REQUEST['Body'])) { | |
$body = $_REQUEST['Body']; | |
} else { | |
$body = False; | |
} | |
if ($body && $body == "1") { | |
$message = "1 is active."; | |
// Add additional logic here... |
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 | |
$ACCOUNT_SID = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxx"; | |
$AUTH_TOKEN = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyy"; | |
$TWILIO_NUMBER = "+1aaabbbcccc"; | |
$TEST_NUMBER = "+1xxxyyyzzzz"; | |
include 'Services/Twilio.php'; | |
$client = new Services_Twilio($ACCOUNT_SID, $AUTH_TOKEN); | |
$client->account->sms_messages->create( |
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 | |
$ACCOUNT_SID = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxx"; | |
$AUTH_TOKEN = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyy"; | |
$TWILIO_NUMBER = "+1aaabbbcccc"; | |
$TEST_NUMBER = "+1xxxyyyzzzz"; | |
include 'Services/Twilio.php'; | |
// Use SimpleXML to get the message body. | |
$xml = <<<XML |
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
<Response> | |
<Say voice="woman">The time is 1:00 pm</Say> | |
</Response> |
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 | |
$xml = new SimpleXMLElement("<Response/>"); | |
$reject = $xml->addChild("Accept"); | |
$reject->addAttribute("Reason", "This buyer is not awesome."); | |
echo $xml->asXML(); | |
?> |
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'); | |
$message = $_REQUEST['Body']; | |
?> | |
<Response> | |
<Sms to="{{YOUR_NUMBER}}"><?php echo $message; ?></Sms> | |
</Response> |
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 | |
// Include Twilio helper library | |
require("Services/Twilio.php"); | |
// Instantiate Twilio Response object to render TwiML. | |
$response = new Services_Twilio_Twiml(); | |
$gather = $response->gather(array('numDigits' => 1)); | |
if (isset($_REQUEST['Digits'])) { | |
$gather-say('Playing part '.$_REQUEST['Digits']); |
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
<Response> | |
<Play>sound_file.mp3</Play> | |
</Response> |
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
from flask import Flask | |
from flask import request | |
import os | |
from random import choice | |
from twilio import twiml | |
app = Flask(__name__) | |