我听说有两种方法可以做到这一点,获取和发布,我知道诸如获取方法的差异,我们在url中发送数据,在邮政方法中,我们在某些方面做到了这一点规则。但是我不知道如何使用SIM800或SIM900以及如何配置我的模块。
首先,您必须初始化simcom模块:
初始化
- 设置上下文类型:at sapbr = 3,1," contype"," gprs" r n
- set apn:at sapbr = 3,1," apn"," yourapn" r n
- 开放式承载者:at sapbr = 1,1 r n
- 查询承载者:at sapbr = 2,1 r n
- 启用http函数:at httpinit r n
- 设置携带者配置文件标识符:at httppara =" cid",1 r n
- 设置url:at httppara =" url"," yoururl" r n
- 在HTTP标题中设置Content-Type字段:at Httppara =" content"," application/json" r n
在初始化SIMCOM模块后,您可以发布或获取:
用于邮政请求
- 设置要发送的JSON字符串:at httpdata = StringLength,20000 r r nyourjsonstring
- http post:at httpaction = 1 r n
get request
- http get:at httpaction = 0 r n