Adul Bari Adul Bari - 4 months ago 52
PHP Question

Can't received inbound sms in plivo, it dosen't trigger codeigniter url

Recently I'm trying to received sms to plivo number. when i sent a sms from outsite plivo then it sent and plivo log status will show delivered. But i need to save data into database. It does not trigger to my controller function.

I already sent sms through another function. it sent and saved into my database but problem is, when anyone reply into this number.

controller function:

public function index()
{
// Sender's phone numer
$from_number = $this->input->get("From"); // $this->input->post("From"); dosen't work.
// Receiver's phone number - Plivo number
$to_number = $this->input->get("To"); // $this->input->post("To"); dosen't work.
// The SMS text message which was received
$text = $this->input->get("Text"); // $this->input->post("Text"); dosen't work.
// 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);
}


Plivo application URL :
http://xxxxxxx.com/receive_sms

Message Method : GET

Message Method : POST // Dosen't work.

Codeigniter Config:
$config['allow_get_array'] = TRUE;

In plivo log status delivered.

any help?

Answer

At the first time i load plivo library class on the sms received controller, it was a problem. I just erase those line from controller and then it works fine.

We have to follow:

Plivo application always get data for codeigniter function. Codeigniter Config: $config['allow_get_array'] = TRUE; SMS received controller only load Codeigniter library file, nothing else.

It works for me.

Comments