title: How to use esp8266WiFi Library GET request to obtain info from a website
body: <p>I'm working on the ESP8266 ESP-01 WiFi module programmed with Arduino IDE to send GET request to a URL and read the contents.<br>
  Trying to modify the below code which uses the ESP8266WiFi library, I'm not clear what to replace for host. Should i put my URL in host or something else?
  Also how to edit the line.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>client.print(String("GET ") + url + " HTTP/1.1\r\n" +
             "Host: " + host + "\r\n" + 
             "Connection: close\r\n\r\n");
  </code></pre>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;ESP8266WiFi.h&gt;
  
  const char* ssid     = "your-ssid";
  const char* password = "your-password";
  
  const char* host = "data.sparkfun.com";
  const char* streamId   = "....................";
  const char* privateKey = "....................";
  
  void setup() {
    Serial.begin(115200);
    delay(10);
  
    // We start by connecting to a WiFi network
  
    Serial.println();
    Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);
  
    WiFi.begin(ssid, password);
  
    while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
    }
  
    Serial.println("");
    Serial.println("WiFi connected");  
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
  }
  
  int value = 0;
  
  void loop() {
    delay(5000);
    ++value;
  
    Serial.print("connecting to ");
    Serial.println(host);
  
    // Use WiFiClient class to create TCP connections
    WiFiClient client;
    const int httpPort = 80;
    if (!client.connect(host, httpPort)) {
      Serial.println("connection failed");
      return;
    }
  
    // We now create a URI for the request
    String url = "/input/";
    url += streamId;
    url += "?private_key=";
    url += privateKey;
    url += "&amp;value=";
    url += value;
  
    Serial.print("Requesting URL: ");
    Serial.println(url);
  
    // This will send the request to the server
    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" + 
                 "Connection: close\r\n\r\n");
    unsigned long timeout = millis();
    while (client.available() == 0) {
      if (millis() - timeout &gt; 5000) {
        Serial.println("&gt;&gt;&gt; Client Timeout !");
        client.stop();
        return;
      }
    }
  
    // Read all the lines of the reply from server and print them to Serial
    while(client.available()){
      String line = client.readStringUntil('\r');
      Serial.print(line);
    }
  
    Serial.println();
    Serial.println("closing connection");
  }
  </code></pre>