我在使用AT通过SIM800模块发送post参数时遇到问题。因为我正在使用FTDI和mac屏幕应用程序终端。
这是我的命令序列:
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","myhost/deviceRegister"
AT+HTTPPARA="CONTENT","application/json"
AT+HTTPDATA=94,120000
OK
DOWNLOAD
POST deviceRegister HTTP/1.1
Host: myhost
Content-Length:13
{"IMEI":"aa"}
AT+HTTPACTION=1
AT+HTTPREAD
直到这里,一切看起来都很好,但是当我在我的服务器中记录我的帖子请求时,我有这个:
+HTTPREAD: 259
POST deviceRegister HTTP/1.1
Host: myhost
Accept: */*
Connection: Keep-Alive
Content-Type: application/json
User-Agent: SIMCOM_MODULE
Content-Length: 94
{"IMEI":"aa"}gister HTTP/1.1
OK
看起来它没有\ n
发布到正文为什么我的帖子正文有标题参数?
答案 0 :(得分:1)
这就是我在sim900调制解调器上尝试的内容 {" myvar1 =" myvalue1"," myvar2" =" myvalue2"}是我的json对象
AT + CGATT?
AT + SAPBR = 3,1," ConType首"" GPRS"
AT + SAPBR = 3,1," APN"" mynetworkprovider.com"
AT + SAPBR = 3,1," USER"" mylogin"
AT + SAPBR = 3,1," PWD""输入mypassword"
AT + SAPBR = 1,1
AT + HTTPINIT
AT + HTTPPARA =" CID",1
AT + HTTPPARA =" URL"" http://myserveraddress/comm.php"
AT + HTTPPARA ="内容""应用/ JSON"
AT + HTTPDATA = 137,5000 => SIM卡响应:下载
内容长度:414
{" myvar1 =" myvalue1"" myvar2" =" myvalue2"}
AT + HTTPACTION = 1
AT + HTTPREAD =>应该响应200 http ok状态
HTH
答案 1 :(得分:0)
我不是专家,但在我的sim900调制解调器上,我试过这个,它适用于我
AT命令初始化调制解调器以进行数据传输 和
AT + HTTPINIT
AT + HTTPPARA = “CID”,1
AT + HTTPPARA = “URL”, “为myhost / deviceRegister”
AT + HTTPPARA = “内容”, “应用程序/ JSON”
AT + HTTPDATA = 94,120000
行
下载
的Content-Length:13
{ “IMEI”: “AA”}
AT + HTTPACTION = 1
AT + HTTPREAD
希望这个帮助