I am sending a HTTP GET request to a server I deployed on digital ocean (Ubuntu/Node.js). On the web browser when I go to my URL 'http://Server_Ip_Address/event/astarttime' or 'http://Server_Ip_Address/event/aendtime' the application on the web successfully performs its transaction.

However, I tried doing the same on my D1 R2 ESP8266 with this code in Arduino IDE: Sometimes it works sometimes it doesn't...I can't figure out why it only works some times and other times it doesn't work at all. Any idea of what it could be? Thank you for your help in advance.

Using these libraries:

#include "ESP8266WiFi.h"
#include <ESP8266HTTPClient.h>

int httpCode = http.GET(); //Send the request
http.end();  //Close connection
int httpCode = http.GET(); //Send the request
http.end(); //Close connection
  • arduino core version? 2.4.1? which lwip? 2? try 1.4. and erase the flash with esptool – Juraj Apr 22 '18 at 5:49
  • Does the web server see the requests in the failing case? – Mark Smith Apr 22 '18 at 9:32
  • Using arduino 1.6.13 it acctually works sometimes but not all of the time — Mark Smith how would I see the log file of the web server & it’s failing requests? – JoeB Apr 22 '18 at 21:15
  • Perhaps I should, somehow, have a confirmation response from server to arduino to confirm that the http get request was successful (& if it wasn’t then it would keep trying? Does that sound like something that could be possible to implement?) – JoeB Apr 22 '18 at 21:17
  • I've no idea how to see the logs but I'll eat my hat if Google doesn't tell you. Generally you should handle failures cleanly and sensibly, but I would investigate and fix the cause rather than bodging it and pushing the problem elsewhere. – Mark Smith Apr 23 '18 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.