sms_hook_flowroute.php 630 B

123456789101112131415161718192021222324
  1. <?php
  2. include "../root.php";
  3. require_once "resources/require.php";
  4. require_once "../sms_hook_common.php";
  5. if (check_acl()) {
  6. if ($_SERVER['CONTENT_TYPE'] == 'application/json') {
  7. $data = json_decode(file_get_contents("php://input"));
  8. if ($debug) {
  9. error_log('[SMS] REQUEST: ' . print_r($data, true));
  10. }
  11. $from = intval(preg_replace('/(^[1])/','', $data->data->attributes->from));
  12. route_and_send_sms($from, $data->data->attributes->to, $data->data->attributes->body);
  13. } else {
  14. die("no");
  15. }
  16. } else {
  17. error_log('ACCESS DENIED [SMS]: ' . print_r($_SERVER['REMOTE_ADDR'], true));
  18. die("access denied");
  19. }
  20. ?>