How do I read parameters from HTML page

Hello,
I have a webserver running on a ESP32 and using :

#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>

I have set up

server.on("/test1", {

Serial.println("test1 rec");

});

server.on("/test2", {
Serial.println("test2 rec");
});

After I have connected to the server and with a browser I send a html page with 192.168.4.1/test1 I then get the message on the serial terminal "test1 rec" and likewise with test2 so server is working.

If I add any parameters in the browser to the line eg 192.168.4.1/test1/12345678,1234567. then I never receive or the esp32 does not see the test1 message.

Why ?, what can I use to get these parameters ?

Thanks in advance

Sd

Parameters are not added to the URL by tacking on "/12345678,1234567" That is specifies a different page that the server does not have.

You would typically do it like
192.168.4.1/test1?parm1=12345678,1234567

Sound like you need to google/read up on HTTP GET

Thanks, im not up to speed with html, is there a simple way to get the complete line into a string for output not individual arguments ?. The library i am using is not the async lib.

HTML is the markup language used to describe the web page. HTTP is the protocol for requesting a web page. You are talking about HTTP, not HTML.

Look at the HelloServer example that comes with the library. It shows you how to fetch all sorts of interesting information from a request.

Thanks - I meant http.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.