You are here

function sms_simplegateway_receive_message in SMS simple gateway 7

Same name and namespace in other branches
  1. 6 sms_simplegateway.module \sms_simplegateway_receive_message()

Receive an SMS message and pass it into the SMS Framework

1 string reference to 'sms_simplegateway_receive_message'
sms_simplegateway_menu in ./sms_simplegateway.module
Implements hook_menu().

File

./sms_simplegateway.module, line 321
Simple gateway module for Drupal SMS Framework. Outbound + Inbound

Code

function sms_simplegateway_receive_message() {
  $gateway = sms_gateways('gateway', 'simplegateway');
  $config = $gateway['configuration'];
  if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($config['sms_simplegateway_recv_content_type'] == 'json') {
      $data = (array) json_decode(file_get_contents('php://input'));
    }
    else {
      $data = $_POST;
    }
  }
  else {
    $data = $_GET;
  }
  sms_incoming($data[$config['sms_simplegateway_recv_number_field']], $data[$config['sms_simplegateway_recv_message_field']], array(
    'gateway_params' => array(),
    'receiver' => $data[$config['sms_simplegateway_recv_gwnumber_field']],
  ));
  drupal_exit();
}