How to receive and manage SMS in a project

Last modified by Stéphane Laurière on 2014/04/08 18:52

You must subscribe to the SMS Recever API (if available on your platform).

By default, your project will receive all SMS that begin with your project name as a keyword inside the smsreceiver.php file.

You can also define other keywords (or phone numbers) and indicate your PHP callback file under the configuration tab of your project.

Take a look at your smsreceiver.php file:

<?php
/*
 * This file has automacally been created by Emerginov Project Creation mecanism.
 * The purpose of this file is to provide a sample SMS receiver management.
 * Please edit the file to handle properly your incoming SMS.
 * You might find many information on how to do so on Emerginov wiki.
 * http://emerginov.ow2.org/xwiki
 */


// Load required configuration & Emerginov Class
require_once("passwords.php");
require_once("Emerginov.php");

// Get SMS information
$sender = $_REQUEST["SOA"];
$content = $_REQUEST["Content"];

// Open a log file
$fh = fopen("log","a");

// Write SMS content to this log file
fwrite($fh, "---- On ".date("r").", I received a SMS from: $sender. Content is: $content\n");

// Close the log file
fclose($fh);
?>

This file will just receive your SMS and store the content in a file called log under your root web folder.

Example:
Let's imagine your project is called ProjectName.
You send a SMS to the emerginov platform (ask the administrator for the number you should send to) with the following content:
ProjectName Hello world !

The smsreceiver.php file will receive the SMS and store the content in the log file.

Open your project web folder to see it: http://projects.youremerginov.com/ProjectName/log

Tags:
Created by Stéphane Laurière on 2012/09/14 14:35

Partners

Orange

VOICES

EU - FP7

OW2

© Emerginov
Site maintained by OW2