Inbound SMS to UK Landline Numbers

HTTP GET/POST Variables

If you choose to have the messages delivered by HTTP, you may either use our standard parameters, or create a custom format for compatibility with any existing application.

If you do not specify any custom parameters, we will deliver the message using the default names.

Default Name Custom Parameters Data
Default Name: originator Custom Parameters: %o Data: The sender's number
Default Name: destination Custom Parameters: %d Data: The destination number
Default Name: message Custom Parameters: %m Data: The message body
Default Name: time Custom Parameters: %t Data: Message timestamp in YYYY-MM-DD HH:MM:SS format
Default Name: unix_time Custom Parameters: %x Data: Message timestamp as a Unix timestamp
Default Name: udh Custom Parameters: %u Data: The UDH header, e.g.: for decoding concatenated messages
Default Name: id Custom Parameters: %i Data: A unique identifier for the message

Once you have successfully purchased your geographical number you will need to follow these steps:

  • Select 'Text-In' -> 'Inbound Geographic SMS' -> 'Configure Numbers'
  • Select 'Edit' on the chosen number
  • Specify 'HTTP POST' as the action
  • Enter destination of the script that will handle your POST, e.g. http://www.example.com/script.php

Relay IP Address

MO messages to these numbers are relayed from this IP address: 194.145.190.4

The following are code examples that can be used with HTTP GET/POST

PHP

<?php
// Include the database handling class 
include('mysqlclass.php');

// Assign POSTED variables
$originator = $_POST['originator'];
$destination = $_POST['destination'];
$message = $_POST['message'];
$time = $_POST['time'];
$unixTime = $_POST['unix_time'];
$udh = $_POST['udh'];
$id = $_POST['id'];

// Create a new instance of the mysql class and write data to database
$mysql = New mysql(0);

$sql = "

INSERT INTO
inbound
(varOriginator, varDestination, varMessage, dtTime, varUnixTime, varUDH, intId)

VALUES
('$originator','$destination', '$message', '$time', '$unixTime', '$udh', '$id')

";

$mysql->query($sql);
?>

ASP

org = Request.QueryString("originator");
dest = Request.QueryString("destination");
msg = Request.QueryString("message");
time = Request.QueryString("time");
unix = Request.QueryString("unix_time");
udh = Request.QueryString("udh");
id = Request.QueryString("id");

Response.Write("Originator: " & org & "
"); Response.Write("Destination: " & dest & "
"); Response.Write("Message: " & msg & "
"); Response.Write("Time: " & time & "
"); Response.Write("Unix Time: " & unix & "
"); Response.Write("UDH: " & udh & "
"); Response.Write("ID: " & id & "
");

Create a MySQL Database to Store the Data

<?php
// Include the database handling class
include("mysqlclass.php");

// Assign POSTED variables
$originator = $_POST['originator'];
$destination = $_POST['destination'];
$message = $_POST['message'];
$time = $_POST['time'];
$unixTime = $_POST['unix_time'];
$udh = $_POST['udh'];
$id = $_POST['id'];

// Create a new instance of the mysql class and write data to database
$mysql = New mysql(0);

$sql = "

INSERT INTO
inbound
(varOriginator, varDestination, varMessage, dtTime, varUnixTime, varUDH, intId)

VALUES
('$originator','$destination', '$message', '$time', '$unixTime', '$udh', '$id')

";

$mysql->query($sql);
?>

MySQL Class to Manage the Connection and Actions on the Database

<?php
class mysql {

    /* public: connection parameters */
    var $debug;
    var $hostname;
    var $databaseName;
    var $username;
    var $password;

    /* private: connection parameters */
    var $conn;
    var $rstemp;
    var $record;

    /**
    * mysql::mysql()
    * Constructor this class – define public connection parameters and
    * call the connect method
    *
    * @param $hostname
    * @param $username
    * @param $password
    * @param $databaseName
    */
    function mysql ($debug=0) {

        $this->debug = $debug;

        if ($this->debug) echo "\n\nDebug On 
\n"; $this->hostname = 'localhost'; $this->username = 'root'; $this->password = ''; $this->databaseName = 'crmProject'; /** * Open connection */ $this->connect(); } /** * mysql::connect() * Open connection with the server * * @return id da conexao */ function connect () { /** * Open connection */ if ($this->debug) echo "Connecting to $this->hostname
\n"; $this->conn = @mysql_connect($this->hostname,$this->username,$this->password) or die("Connection to $server failed
\n"); /** * Select to database */ if ($this->debug) echo "Selecting to $this->databaseName
\n"; @mysql_select_db($this->databaseName,$this->conn) or die("Error:" . mysql_errno() . " : " . mysql_error() . "
\n"); return $this->conn; } /** * mysql::query() * Execute SQL * * @param $sql * @return */ function query($sql) { if ($this->debug) echo "Run SQL: $sql
\n\n"; $this->rstemp = @mysql_query($sql,$this->conn) or die("Error:" . mysql_errno() . " : " . mysql_error() . "
\n"); return $this->rstemp; } /** * mysql::num_rows() * return number of records in current select * * @param $rstemp * @return */ function num_rows() { $num = @mysql_num_rows($this->rstemp); if ($this->debug) echo "$num records returneds
\n\n"; return $num; } /** * mysql::movenext() * fetch next record in result * * @return */ function movenext() { if ($this->debug) echo "Fetching next record..."; $this->record = @mysql_fetch_array($this->rstemp); $status = is_array($this->record); if ($this->debug && $status) echo "OK
\n\n"; elseif ($this->debug) echo "EOF
\n\n"; return($status); } /** * mysql::getfield() * get field value from the current record * * @param $field * @return */ function getfield($field){ if ($this->debug) { echo "Getting $field..."; //this resource require PHP 4.1 or righter if (phpversion() >= 4.1) { if (array_key_exists($field,$this->record)) echo "OK
\n\n"; else echo "Not found
\n\n"; } else echo "
\n\n"; } return($this->record[$field]); } } ?>

Inbound Action

<?php
include("mysqlclass.php");

$originator = $_POST['originator'];
$destination = $_POST['destination'];
$message = $_POST['message'];
$time = $_POST['time'];
$unixTime = $_POST['unix_time']; $udh = $_POST['udh'];
$id = $_POST['id'];

$mysql = new mysql(0);
$sql = "INSERT INTO inbound (varOriginator, varDestination, varMessage, dtTime, varUnixTime, varUDH, intId) VALUES ('$originator', '$destination', '$message', '$time', '$unixTime', '$udh', '$id')";
$mysql->query($sql);
?>
AutoJemma®

How can I help you today?

Can't find what you're looking for, ask a question below!

Additional Details

AutoJemma® can make mistakes, please verify any critical information.