我一直在尝试实现一个从我们发送到Plivo的短信中检索数据的函数。目前在我的网站上,我可以发送短信,检查状态,但我希望用户能够响应这些短信,并将这些数据存储到我的数据库中。I followed the documentation here我有这个控制器:
<?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);
}
}在本例中,他们使用了$_REQUEST,但似乎在Codeigniter上不起作用,所以我尝试了$this->input->get("From"),但没有成功。Plivo收到短信,它写在Plivo日志上,我写了指向这个控制器的URL。
有什么想法吗?
发布于 2016-04-27 13:15:58
您可以按照以下步骤调试此问题:
log_message(‘错误’,"Plivo响应:“。print_r($_REQUEST,true) ."\n");
https://stackoverflow.com/questions/36842602
复制相似问题