       return;
     }
   }
+  String line;
+  while(client.available()){
+    line = client.readStringUntil('\r');
+    line.trim();
+    Serial.println(line);
+  }
+  client.stop();
+  if (!client.connect(host, httpPort)) {
+    Serial.println("connection failed");
+    return;
+  }
+
   
-   String line;
+  delay(1000);
+
+  
+  // This will send the request to the server
+  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
+               "Host: " + host + "\r\n" + 
+               "User-Agent: test\r\n"+
+               "Connection: close\r\n\r\n");
+  //unsigned long timeout = millis();
+  while (client.available() == 0) {
+    if (millis() - timeout > 5000) {
+      //Serial.println(">>> Client Timeout !");
+      client.stop();
+      return;
+    }
+  }
+  
+   //String line;
 
   // Read all the lines of the reply from server and print them to Serial
   while(client.available()){
     line = client.readStringUntil('\r');
     line.trim();
+    Serial.println(line);
   }
 
   if(line.equals("true")){

    url += privateKey;
    url += '/';
    
String data = "alive=true";
client.print(String("POST ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 //"Connection: close\r\n" +
                 //"Content-Type: application/json\r\n" +
                 "Content-Type: application/x-www-form-urlencoded\n"+
                 "Content-Length: " + data.length() + "\r\n" +
                 "\r\n" + // This is the extra CR+LF pair to signify the start of a body
                 data + "\n");
    

  // 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 > 5000) {


  // Use WiFiClient class to create TCP connections
  WiFiClient client;
  const int httpPort = 80;
  if (!client.connect(host, httpPort)) {
    Serial.println("connection failed");
    return;
