我一直在尝试实现一个从我们发送给Plivo的短信中检索数据的功能。 目前在我的网站上,我可以发送短信,检查状态,但我希望用户能够响应这些短信并将这些数据存储到我的数据库中。我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-&gt; input-&gt; get(&#34; From&#34;)但是没有成功。 Plivo接收短信,它是在Plivo Logs上收到的,我写了指向该控制器的URL。
有什么想法吗?
答案 0 :(得分:0)
您可以按照以下步骤调试此问题:
log_message(&#39;错误&#39;,&#34; Plivo响应:&#34; .print_r($ _ REQUEST,true) &#34; \ n&#34);