0

I've heard that there are two methods to do that, GET and POST and I know the differences like in GET method we send data in URL and in POST method we do that in some rules. But I don't know how to do that with sim800 or sim900 and how to configure my module.

4

1 回答 1

1

首先你必须初始化 SIMCOM 模块:

初始化

  1. 设置上下文类型:AT+SAPBR=3,1,"CONTYPE","GPRS"\r\n
  2. 设置 APN: AT+SAPBR=3,1,"APN","YourAPN"\r\n
  3. 打开承载:AT+SAPBR=1,1\r\n
  4. 查询承载:AT+SAPBR=2,1\r\n
  5. 开启 HTTP 功能:AT+HTTPINIT\r\n
  6. 设置承载配置文件标识符:AT+HTTPPARA="CID",1\r\n
  7. 设置网址:AT+HTTPPARA="URL","YourURL"\r\n
  8. 在 HTTP 头中设置 Content-Type 字段:AT+HTTPPARA="CONTENT","application/json"\r\n

SIMCOM 模块初始化后,您可以 POST 或 GET:

对于 POST 请求

  1. 设置要发送的 JSON 字符串:AT+HTTPDATA=StringLength,20000\r\nYourJSONString
  2. HTTP POST: AT+HTTPACTION=1\r\n

对于 GET 请求

  1. HTTP GET: AT+HTTPACTION=0\r\n
于 2017-08-16T21:36:48.683 回答