Cliente - Servidor / comando preso no loop não consigo resolver com Esp 01

Tenta esse código aqui:

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#define D2 2

boolean estadoLed = false;
boolean lerBotao = true;
const char* ssid = "D-Link_DIR-615";
const char* password = "******";

HTTPClient http;

void rptaSrv(int httpCode){     
if(httpCode == 200) {
String payload = http.getString();
Serial.println(payload);
} else {
Serial.print("[HTTP] GET... failed, no connection or no HTTP server\n");
}
http.end();
}

void setup() {
pinMode(D2,INPUT_PULLUP);
Serial.begin(115200);
delay(10);
Serial.print("Conectando a ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}

Serial.println("WiFi conectada");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}

void loop(){

  while(digitalRead(D2)== true){
    
    if (lerBotao == true){
      
      if(estadoLed ==true){
         http.begin("192.168.0.99", 80, "/led1on=1"); //HTTP
         int httpCode1 = http.GET();
         rptaSrv(httpCode1);
      } else {
         http.begin("192.168.0.99", 80, "/led1off=0"); //HTTP
         int httpCode1 = http.GET();
         rptaSrv(httpCode1);
      }
      http.end();
      estadoLed = !estadoLed;
      lerBotao = false;
    }
    
  }

  lerBotao = true;

}