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> http.begin("http://Server_Ip_Address:80/event/astarttime"); int httpCode = http.GET(); //Send the request http.end(); //Close connection http.begin("http://Server_Ip_Address:80/event/aendtime"); int httpCode = http.GET(); //Send the request http.end(); //Close connection