ESP8266 Web Data

I have searched and searched and cant find an answer that helps correctly, hopefully someone here can help me get over this hump.

I am trying to use an ESP8266 made by HILetgo to pull data from a txt file, which should only have a 1/0 in the file.

I can connect to the file, and it pulls data, but instead of the text data, it pulls all the headers and html code that would be needed to display the txt file as a website. I have tried to force it to read as a txt file bu adding the http.addHeader code, to no avail.

I am new to programming in this world, please, any guidance would be greatly appreciated. Ill include the code and the response.


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

const char* ssid = “";
const char* password = "

void setup() {


//connect to wifi network

Serial.println(“Hello Digital Craft”);
Serial.print("Connecting ");

while (WiFi.status() !=WL_CONNECTED)

Serial.println(“WiFi Connected”);


void loop() {
// Verfiy WiFi is connected:
if (WiFi.status() == WL_CONNECTED) {

HTTPClient http; // Object of the class HTTPClient.

http.begin(“”); // Request destination.
http.addHeader(“Content-Type”, “text/plain”);
int httpCode = http.GET(); // Send the request.

if (httpCode > 0) { //Check the returning code

Serial.println(“We got a repsonse!”);
String payload = http.getString(); // Get the text from the destination (1 or 0).
Serial.println(payload); // Print the text.
digitalWrite(2, payload.toInt()); // Send the payload value to the pin.


Serial.println(“Something baaaaaaad happened!”);


http.end(); //Close connection

delay(1000); //Send a request every 30 seconds

We got a repsonse!

This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support

That output does not look like you retrieved your text file. It looks like the webserver is telling you it requires javascript to operate and javascript is not supported on the arduino.