Majid Roustaei
Majid Roustaei

Reputation: 1764

How can I send data to a web server and read that by sim800 or sim900?

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.

Upvotes: 0

Views: 3934

Answers (1)

Borja Tarazona
Borja Tarazona

Reputation: 165

First you have to initialize the SIMCOM module:

Initialization

  1. Set context type: AT+SAPBR=3,1,"CONTYPE","GPRS"\r\n
  2. Set APN: AT+SAPBR=3,1,"APN","YourAPN"\r\n
  3. Open bearer: AT+SAPBR=1,1\r\n
  4. Query bearer: AT+SAPBR=2,1\r\n
  5. Enable HTTP functions: AT+HTTPINIT\r\n
  6. Set bearer profile identifier: AT+HTTPPARA="CID",1\r\n
  7. Set the URL: AT+HTTPPARA="URL","YourURL"\r\n
  8. Set Content-Type field in the HTTP header: AT+HTTPPARA="CONTENT","application/json"\r\n

After the SIMCOM module has been initialized you can POST or GET:

For a POST request

  1. Set the JSON string to be sent: AT+HTTPDATA=StringLength,20000\r\nYourJSONString
  2. HTTP POST: AT+HTTPACTION=1\r\n

For a GET request

  1. HTTP GET: AT+HTTPACTION=0\r\n

Upvotes: 2

Related Questions