function callOptions() { // ask the caller who they want to call $result = ask("To call: Home, press 1. To call a specific number, press 2. To end this call, press star.", array("choices" => "1, 2, *", "repeat" => 3)); if ($result->name == 'choice') { switch ($result->value) { case '1': forwardCall('14155555555'); break; case '2': $call = ask("Please enter the 10 digit number you would like to call, starting with the area code!", array("choices" => "[10 DIGITS]", "repeat" => 3)); if ($call->name == 'choice') { forwardCall('1' . $call->value); } else { say("Sorry, I didn't get that."); } break; case '*': return; } } // recursively call this function now until the user gets hung up on or until they hang up callOptions(); return; }
$curl_headers[] = "{$header_key}: {$header_value}"; } if (!empty($curl_headers)) { curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_headers); } curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); if ($_POST['method'] == 'POST') { curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, stripslashes(get_magic_quotes_gpc() ? stripslashes($_POST['params']) : $_POST['params'])); } curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); //curl_setopt($ch, CURLOPT_PROXY, "http://localhost:8888"); $output = curl_exec($ch); $info = curl_getinfo($ch); if ($output === false) { header("HTTP/1.1 404 Not Found"); exit; } else { list($response_headers, $response_body) = explode("\r\n\r\n", $output, 2); $response_header_lines = explode("\r\n", $response_headers); // just send the response code back. header($response_header_lines[0]); print $response_body; } curl_close($ch); } forwardCall();