Problem GET Request Server esp8266

Hello

After a view runs (1-3) of the ServerDate() void i get "TCP connection failed". Can somebody help me?

#include <ESP8266WiFi.h>

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

const char* host = "myServer.com";
const char* streamId   = "STREAMID";
const char* privateKey = "MEINSCHLUESSEL";

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());
}



void ServerData(){
  int value = 0;

  WiFiClient client;
  if (!client.connect(host, 80)) {
    Serial.println("TCP connection failed");
    return;
  }
  
  String url = "/input.php";
  url += "?key=";
  url += privateKey;
  url += "&value=";
  url += value;
  
  // 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) {
      Serial.println(">>> TCP 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);
  }
}



void loop() {
  ServerData();
  delay(10000);
}

Where do you close the connection? How many simultaneous, open connections do you think you can have?

I added

  while(client.available()){
    String line = client.readStringUntil('\r');
    Serial.print(line);
  }

  client.stop();
}

But the same problem.
Sorry. I'm a beginner in Internet connections.

When you read all the data that the server sends back, the connection will be closed automatically. So, read all the data. There might even be some clues in the data.

client.connected() and client.available() are interesting functions.

Do you mean there is a problem in my php?
I used a very simple php, that send me the variables back. Only for test.

I use the example fro arduino. But there is a problem.

<?php

$private_key = $_GET['key'];
$value = $_GET['value'];

echo $private_key . '
' . $value . '\r';

?>