title: How to solve espwifi.h library
body: <pre><code>#include &quot;WiFiEsp.h&quot;
  
  char ssid[] = &quot;***&quot;;            // your network SSID (name)
  char pass[] = &quot;#&quot;;        // your network password
  int status = WL_IDLE_STATUS;     // the Wifi radio's statusb
  char server[] = &quot;apiv2.corona-live.com&quot;;
  
  // Initialize the Ethernet client object
  WiFiEspClient client;
  
  void setup()
  {
    // initialize serial for debugging
    Serial.begin(115200);
    // initialize serial for ESP module
    Serial1.begin(115200);
    // initialize ESP module
    WiFi.init(&amp;Serial1);
  
    // check for the presence of the shield
    if (WiFi.status() == WL_NO_SHIELD) {
      Serial.println(&quot;WiFi shield not present&quot;);
      // don't continue
      while (true);
    }
  
    // attempt to connect to WiFi network
    while ( status != WL_CONNECTED) {
      Serial.print(&quot;Attempting to connect to WPA SSID: &quot;);
      Serial.println(ssid);
      // Connect to WPA/WPA2 network
      status = WiFi.begin(ssid, pass);
    }
  
    // you're connected now, so print out the data
    Serial.println(&quot;You're connected to the network&quot;);
    
    printWifiStatus();
  
    Serial.println();
    Serial.println(&quot;Starting connection to server...&quot;);
    // if you get a connection, report back via serial
    if (client.connect(server, 80)) {
      Serial.println(&quot;Connected to server&quot;);
      // Make a HTTP request
      client.println(&quot;GET /stats.json?timestamp=1634891368873 HTTP/1.1&quot;);
      client.println(&quot;Host: apiv2.corona-live.com&quot;);
      client.println(&quot;Connection: close&quot;);
      client.println();
    }
  }
  
  void loop()
  {
    delay(500);
    // if there are incoming bytes available
    // from the server, read them and print them
     while(client.connected())
     {
        // There is a client connected. Is there anything to read?
        while(client.available() &gt; 0)
        {
           char c = client.read();
           Serial.print(c);
        }
        Serial.println();
        Serial.println(&quot;Waiting for more data...&quot;);
        delay(100); // Have a bit of patience...
     }
    
  
    // if the server's disconnected, stop the client
    if (!client.connected()) {
      Serial.println();
      Serial.println(&quot;Disconnecting from server...&quot;);
      client.stop();
  
      // do nothing forevermore
      while (true);
    }
  }
  
  
  void printWifiStatus()
  {
    // print the SSID of the network you're attached to
    Serial.print(&quot;SSID: &quot;);
    Serial.println(WiFi.SSID());
  
    // print your WiFi shield's IP address
    IPAddress ip = WiFi.localIP();
    Serial.print(&quot;IP Address: &quot;);
    Serial.println(ip);
  
    // print the received signal strength
    long rssi = WiFi.RSSI();
    Serial.print(&quot;Signal strength (RSSI):&quot;);
    Serial.print(rssi);
    Serial.println(&quot; dBm&quot;);
  }
  </code></pre>
  <p>Result :</p>
  <p>[WiFiEsp] Connecting to apiv2.corona-live.com
  Connected to server
  HTTP/1.1 301 Moved Permanently
  D[WiFiEsp] TIMEOUT: 720</p>
  <p><a href="https://apiv2.corona-live.com/stats.json?timestamp=1634891368873" rel="nofollow noreferrer">https://apiv2.corona-live.com/stats.json?timestamp=1634891368873</a> Can I get JSON data from these sites? If possible, I would like to know why this error occurred.</p>
  <p>(I use arduino mega 2560 + esp8266/esp01 module</p>