嗨,抱歉我的英语不好。我正在尝试使用Codeigniter从服务器上的Sim800接收JSON数据。当在config.php文件中时,我设置了$config['csrf_protection'] = TRUE;
服务器响应403错误,当它是false
服务器响应200时,一切正常。我该怎么办?现在在config.php中,我添加以下内容:$config['csrf_exclude_uris'] = array('customer/query');
,还有另一种方法吗?
在我的客户端Sim800模块中,我正在使用此命令。
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","mtnirancell"
AT+SAPBR=1,1
AT+SAPBR=2,1
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://www.mysiteaddress.ir/customer/query"
AT+HTTPPARA="CONTENT","application/json"
AT+HTTPDATA=20,10000 //data is 20 Bytes,maximum latency time is 10000 ms.
// Wait a few moments to Receive "DOWNLOAD" from sim800c module
{"data":"my sensor value"} // The data I want to send
AT+HTTPACTION=1 // send data with POST method
在此命令模块响应之后
OK
+HTTPACTION: 1,403,86 // 403 error
对于PHP服务器,我正在使用以下代码:
$request_body="";
$request_body = file_get_contents('php://input');
$record = urldecode($request_body);
$record = json_decode($request_body,true);