I've been trying to implement a function that retrieve the data from a SMS we send to Plivo. Currently in my website, I can send a SMS, check the status, but I want users to be able to respond to these SMS and store these data into my database. I followed the documentation here I have this controller :
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Receive extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->model('receive_model');
}
public function index()
{
// Sender's phone numer
$from_number = $this->input->get("From");
// Receiver's phone number - Plivo number
$to_number = $this->input->get("To");
// The SMS text message which was received
$text = $this->input->get("Text");
// Output the text which was received to the log file.
// error_log("Message received - From: ".$from_number.", To: ".$to_number. ", Text: ".$text);
$arr = array("from" => $from_number, "to" => $to_number, "text" => $text);
$this->receive_model->add($arr);
}
}
In the example, they use $_REQUEST but it seems that it doesn't work on Codeigniter, so I tried with $this->input->get("From") but no success. Plivo receives the SMS, it's written Received on Plivo Logs, and I wrote the URL that points to this controller.
Any idea ?