Arduino

df robot sim808 HTTP Post example code

userHead tu4kin 2022-11-20 13:20:05 693 Views1 Replies

Good day! 

 

I bought df robot sim808 shield  for my project. I managed to establish TCP connect and send GET request. May I ask anyone to provide examples how to do POST request?
I tried different options  like this: 

void gsm_http_post( String postdata) {

  Serial.println(" --- Start GPRS & HTTP --- ");

  gsm_send_serial("AT+SAPBR=1,1");

  gsm_send_serial("AT+SAPBR=2,1");

  gsm_send_serial("AT+HTTPINIT");

  gsm_send_serial("AT+HTTPPARA=CID,1");

  gsm_send_serial("AT+HTTPPARA=URL," + url);

  gsm_send_serial("AT+HTTPPARA=CONTENT,application/x-www-form-urlencoded");

  gsm_send_serial("AT+HTTPDATA=192,5000");

  gsm_send_serial(postdata);

  gsm_send_serial("AT+HTTPACTION=1");

  gsm_send_serial("AT+HTTPREAD");

  gsm_send_serial("AT+HTTPTERM");

  gsm_send_serial("AT+SAPBR=0,1");

}

but when I use directly AT commands and NOT  df robot library it just doesnt work.
Thanks in advance,
 

2023-02-23 22:51:23

HI

If you want to use AT commend on SIM808 GSM/GPRS/GPS IoT Board (Arduino Leonardo Compatible)(SKU:DFR0355), you should first send “AT” to enter AT mode.

You could refer to the following code

Hope it can help.

 

userHeadPic NeloKin