Skip to content

Instantly share code, notes, and snippets.

@reneighbor
Created March 26, 2012 20:51
Show Gist options
  • Save reneighbor/2209574 to your computer and use it in GitHub Desktop.
Save reneighbor/2209574 to your computer and use it in GitHub Desktop.
Calling Card App
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Gather action="handle-input.php" method="POST">
<Say>Thanks for using the phone card app. Please dial the number you'd like to call. Dial the area code and full seven digits.</Say>
</Gather>
</Response>
<?php
if (preg_match('/^\d{10}$/', $_REQUEST['Digits'])) {
include("inbound-call.xml");
} else {
include("dial-input.php");
}
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<Response>
<Dial>$_REQUEST['Digits']</Dial>
<Say>The call failed or the called party hung up. Goodbye.</Say>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment