Hello!
I'm working on a small project for my ESP-12 but I'm having some issues. I'm getting HTTP error code 400 (invalid request) where the payload does not tell me whats wrong. The server I'm requesting just states something is wrong ![]()
What I wish to to is to perform a GET request to a web server. At the moment I'm just polling my own web server to see if I could get a HTTP 200 (OK).
Im using the ESP8266HTTPClient.h library.
http.begin("http://fagerbakke.net");
http.addHeader("Content-Type", "text/html");
http.addHeader("Accept", "text/html");
http.addHeader("User-Agent", "ESP8266");
int httpCode = http.GET()
String payload = http.getString();
Serial.print("HTTP code: ");
Serial.println(httpCode);
As you guys can see I've tried to set different headers, I'm unsure on what standard the HTTP request is. My goal is to communicate with a API.
Could anyone point me in the right direction?