How the read a website-content with ESP8266 ?

Hello falks,

I plan a new project: I wanna read out the text of a website, for example:

htttp://mysite.com/site.php

By "text" I mean that text what is given out by php, so not the actual code. Only the text.

Thanks.

Look at the examples that come with the ESP8266HTTPClient library. A basic GET will return whatever that php script spits out

thanks man. I have tried the code. but id only gets me an http-code like 301 or 404. What I asked for, was the html (or php) page itself. I only wanna read out the text of a specific html-file. No images, just the text of a html webpage.

I have just figured it out on myself :smiley: here is the code:

#include <ESP8266WiFi.h>

const char* ssid = "Netgear";
const char* password =  "11111111";


const char* host = "your-site.com";
    String url = "/yourpage.php";
String line;

void setup()
{
  Serial.begin(115200);
  Serial.println();

  Serial.printf("Connecting to %s ", ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println(" connected");
}


void loop()
{
  WiFiClient client;
  Serial.printf("\n[Connecting to %s ... ", host);
  if (client.connect(host, 80))
  {
    Serial.println("connected]");

    Serial.println("[Sending a request]");
    client.print(String("GET /") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
               "Connection: close\r\n" +
                "\r\n"
                );

    Serial.println("[Response:]");
    while (client.connected())
   {    
    line = client.readStringUntil('\r');
    Serial.print(line);
   }

    client.stop();
    Serial.println("\n[Disconnected]");
  }
  else
  {
    Serial.println("connection failed!]");
    client.stop();
  }  
  delay(5000);
}