In the Arduino ESP8266 Web Server library, you can use the header
method to get the value of a specific header. Here’s an example of how you can do this:
server.on("/getValues", HTTP_POST, []() {
if(server.hasHeader("MyHeader")) {
String headerValue = server.header("MyHeader");
// Use headerValue...
}
server.send(200, "text/plain", "OK");
});
In this example, server.hasHeader("MyHeader")
checks if the request contains a header named “MyHeader”. If it does, server.header("MyHeader")
gets the value of the “MyHeader” header. Replace “MyHeader” with the name of the header you want to read.