POST to website
Posted: Thu Nov 22, 2018 2:04 pm
hi , I am using the ESP 32 to send parameters VIA POST to website , I am using this code :
the problem is that the process is taking 2 sec give or take , is there any way that I can make it faster ?
- timeA=millis();
- USE_SERIAL.println(timeA - timeB);
- strTotURL=strBaseUrl+strPage;
- strTotURL.replace(" ", "");
- //USE_SERIAL.println(strTotURL);
- http.begin(strTotURL, ca); //HTTPS
- http.addHeader("Content-Type", "application/x-www-form-urlencoded", false, true);
- httpCode = http.POST(strParams);
- if(httpCode > 0) // httpCode will be negative on error
- {
- if(httpCode == HTTP_CODE_OK) // file found at server
- {
- String payload = ">ADJ "+http.getString();
- USE_SERIAL.println(payload);//+payload
- timeA=millis();
- /*USE_SERIAL.print("time befor : " + timeB/1000);
- USE_SERIAL.print(" time after : " + timeA/1000);
- USE_SERIAL.println(" elapsed : " + ((timeA-timeB)/1000));*/
- USE_SERIAL.println(timeA - timeB);
- }
- else
- {
- String payload = http.getString();
- USE_SERIAL.println(String(">fail")+payload);
- }
- }
- else
- {
- USE_SERIAL.print(String(">")+httpCode);
- USE_SERIAL.println(">Acc ER1");
- }
- http.end();