reasonableframework/route/api.twilio.php

29 lines
619 B
PHP
Raw Normal View History

2019-04-15 01:53:19 +00:00
<?php
/**
2019-04-15 06:20:15 +00:00
* @file api.twilio.php
2019-04-15 01:53:19 +00:00
* @date 2019-04-15
* @author Go Namhyeon <gnh1201@gmail.com>
2019-04-15 06:20:15 +00:00
* @brief Twilio API controller
2019-04-15 01:53:19 +00:00
*/
2019-04-15 01:53:41 +00:00
loadHelper("twilio.api");
2019-04-15 04:30:13 +00:00
$action = get_requested_value("action", array("_JSON", "_ALL"));
2019-04-16 08:09:43 +00:00
$message = get_requested_value("message", array("_JSON", "_ALL"));
2019-04-15 04:30:13 +00:00
$to = get_requested_value("to", array("_JSON", "_ALL"));
2019-04-15 01:58:16 +00:00
2019-04-16 08:09:43 +00:00
$response = false;
2019-04-15 01:58:16 +00:00
switch($action) {
2019-04-16 08:09:43 +00:00
case "text":
$response = twilio_send_message($message, $to);
2019-04-15 01:58:16 +00:00
break;
case "voice":
2019-04-16 08:09:43 +00:00
$response = twilio_send_voice($message, $to);
break;
2019-04-15 01:58:16 +00:00
}
header("Content-Type: application/json");
echo json_encode($response);