【发布时间】:2016-07-19 11:47:34
【问题描述】:
最近我正在尝试接收短信到 plivo 号码。当我从外部 plivo 发送一条短信时,它已发送,并且 plivo 日志状态将显示已发送。但我需要将数据保存到数据库中。它不会触发我的控制器功能。
我已经通过另一个功能发送了短信。它已发送并保存到我的数据库中,但问题是,当有人回复此号码时。
控制器功能:
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 应用程序网址: http://xxxxxxx.com/receive_sms
消息方法:GET
消息方法:POST // 不起作用。
Codeigniter 配置: $config['allow_get_array'] = TRUE;
在 plivo 日志状态下传递。
有什么帮助吗?
【问题讨论】:
-
如果您自己解决了,请自行发布答案。给别人看。
-
你是怎么解决的?
-
我第一次在收到短信的控制器上加载 plivo 库类,这是一个问题。我只是从控制器中删除那些行,然后它就可以正常工作了。 ** 我们必须遵循 1. Plivo 应用程序总是获取 codeigniter 函数的数据。 2. Codeigniter 配置:
$config['allow_get_array'] = TRUE;3. SMS 接收控制器只加载 Codeigniter 库文件,没有别的。 **
标签: php codeigniter api sms-gateway plivo