Fetching txt file's contents from a webhost using esp8266 I am trying to access a txt file in my website and fetch its contents that is hosted by 000webhost. I used this code:

void sendGET() //client function to send/receive GET request data.
{
 WiFiClient client;
 if (client.connect(host, httpPort)) {  //starts client connection, checks for connection
 Serial.println("connected");
 client.println("GET /status.txt HTTP/1.1"); //download text
 client.println("Host: *****.000webhostapp.com");
 client.println("Connection: close");  //close 1.1 persistent connection
 client.println(); //end of get request
}
else {
 Serial.println("connection failed"); //error message if no client connect
 Serial.println();
}
bool rn = false;
while (client.connected() &amp;&amp; !client.available()) delay(1); //waits for data
while (client.connected() || client.available()) { //connected or data available
char c = client.read(); //gets byte from ethernet buffer
Serial.print(c); //prints byte to serial monitor
//    responsed = c;
if (rn == true) {
  if (c == '1') {
    Open();
  }
  else if (c == '0') {

  }
}
if (c == '!') {
  rn = true;
 }
}

Serial.println();
Serial.println("disconnecting.");
Serial.println();
client.stop(); //stop client
rn = false;
}


but in my serial monitor, it echoed

connected
HTTP/1.1 200 OK
Date: Tue, 20 Nov 2018 06:26:41 GMT
Content-Type: text/plain; charset=UTF-8
Content-Length: 1
Last-Modified: Mon, 19 Nov 2018 10:01:12 GMT
Accept-Ranges: bytes
Server: awex
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Request-ID: 4575720f977969af975e822bc1e15eea
Age: 10203
X-Cache: HIT from localhost
X-Cache-Lookup: HIT from localhost:3128
Via: 1.1 localhost (squid/3.5.27)
Connection: close

1
disconnecting.


why isn't it reading the content? i am new to this platform, thank you.

edit, the file contains only two characters. i used ! to indicate that the next number will be the one to store, and the next is either 0 or 1 based on the api i made. in short it is used to transfer my api's response to be read by arduino using esp8266
Your connection to the web server is through a Squid caching proxy.  It is delivering a cached version of the file:

X-Cache: HIT from localhost
X-Cache-Lookup: HIT from localhost:3128


The Age header shows you how long the page has been in the cache:

Age: 10203


That's been cached for about 2.8 hours.

You need to tell the cache not to get a cached version, but instead to always go to the server to get the latest copy.  To do that you should be able to include a "no-cache" header in your request:

Cache-Control: no-cache


That should tell squid "Don't cache this page - get the real one".

You can also add the HTTP/1.0 version of the same thing:

Pragma: no-cache


That way if one doesn't work on that version of squid the other one should.