Created
February 23, 2012 04:56
-
-
Save twohlix/1890379 to your computer and use it in GitHub Desktop.
Apartment Door Unlocker - twilio style
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("content-type: text/xml"); | |
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; | |
function randomResponseString(){ | |
$responses = array( 'Sup wid it?', 'Helloooooooooooooo', | |
'Noob Noob Noob Noob', 'Let the Base Cannon Kick It: wub wub wub wub', | |
'A horse passes behind you', 'Help I am stuck in an apartment buzzer factory. Please send help!', | |
'Skynet became self aware at '.date('g h A').' today.', 'Access Denied', | |
'I will grant you access if you spin around 3 times! Go on. Do it. Hooray', | |
); | |
return $responses[rand(0, sizeof($responses)-1)]; | |
//return $responses[sizeof($responses)-1]; //for testing | |
} | |
?> | |
<Response> | |
<Say><?php echo randomResponseString(); ?></Say> | |
<Pause length="1"/> | |
<Play>http://example.com/twilio/dtmf-9.mp3</Play> | |
<Pause length="1"/> | |
<Hangup/> | |
</Response> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment