public
Created

Apartment Door Unlocker - twilio style

  • Download Gist
door_unlock.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<?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>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.