ESP32 Wifi Server Receiving Data and Acting on it

I'm using code found on GITHUB called "ESP32_WiFi_Server_Sending_Receiving_Data" for my project.
The example code uses an if statement to find and trigger an event.

        if (currentLine.endsWith("GET /H")) {
          digitalWrite(LED_PIN, HIGH);               // GET /H turns the LED on

Instead of my webpages ending in /H or /L, my pages end in a number /1 or /2 up to /200
I need to find and store the number which will be later used to access a file on the sdcard i.e. 1.txt or 2.txt .... 200.txt. Any ideas how to get the number right after "GET /?"
Thanks and please if you can show me the line(s) of code.

You're going to have to post more than that single line. Maybe a link to the rest of the sketch you are using?

When I tap on one of the clients hyperlinks it starts returning the following information in the string currentline. As you can see there is GET /0 the 0 is what I need capture and assign it to a variable

GG
EGE
TGET
GET
/GET /
0GET /0
GET /0
HGET /0 H
TGET /0 HT
TGET /0 HTT
PGET /0 HTTP
/GET /0 HTTP/
1GET /0 HTTP/1
.GET /0 HTTP/1.
1GET /0 HTTP/1.1

The code you have linked to is doing pattern matching to take one of two actions based on the url that the board receives an HTTP GET request to. It's not going to give you the flexibility to capture the number after the "/" and put it into a variable.

What exactly are you trying to do with your project? Having some idea of that will help to give you an example that more closely aligns to what you are trying to accomplish.

What I'm trying to do is a little complicated to explain but this is the last piece of the puzzle.
String currentLine = ""; holds the incoming client data so there should be a way to get the information I need from it. Just not sure how to do it

@zuelatak

Your other topic on the same subject deleted.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

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