website connect to ESP8266

Dear All

I need to connect my website to ESP8266 module

My website have a button when i pressed the button it sends HEX value ( Ex 0x21)
My website running on wamp local server
my website send data on port21

My ESP is working how can I tell it I have a client software
I insert IP address to my client software taken from ESP and set the port and connect it and it is successful

Now I need to connect my website to ESP

Please advice

Thanks in advance

How are you uploading to the ESP8266?

ESP codes please advice

/ Connect to WiFi network
  Serial.println();
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  delay(1000);
  
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.print(".");
  }

  delay(1000);
  Serial.println("");
  Serial.println("WiFi connected");

  // Start the server
  server.begin();
  
  delay(1000);
  Serial.println("Server started");

  // Print the IP address
  Serial.print("Use this URL to connect: ");
  delay(1000);
  Serial.print(WiFi.localIP());
}

void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {
    return;
  }

  // Wait until the client sends some data
  Serial.println("new client");

  while (!client.available()) {
    delay(1);
  }

  // Read the first line of the request
  String request = client.readStringUntil('\r');

  Serial.print("Received: ");
  Serial.println(request);

  client.flush();

You want the esp to be a client but you're using server code?

Dear Website not run on ESP

It is run on my laptop local host using wamp sever

Exactly

I need to connect my website to ESP8266 module
My website have a button when i pressed the button it sends HEX value ( Ex 0x21)

And where do you think this is sent? Who will press the button and where do you want "the value to go"?

DEAR JML

Thanks for the reply

my website is running on my laptop using wamp server

web button is pressed by myself

my laptop and my ESP connected to hostspot ( 4G WiFi router

my ESP connected to rs232 and my desktop

please advice

So when you press the button your server is notified - right? So where do you see your ESP in this? It does not play any role.

So you need to change the roles - either your ESP becomes the web server and presents the front end to a browser, thus when you click, the ESP is notified or You need to change the code so that when you press the button a request (HTTP or any network transport layer connexion is established ) is sent to your ESP with the data.

Makes sense?