Parse HTTP Get Request

How can I parse this string GET /STA/ID=HelloWorld/Pass=Testin123 HTTP/1.1
First I need to check for STA, if it exists, continue to scan the string. Put Value of ID in this case HelloWorld should be store in String data type SSID and Value of Pass, in this case Testin123 should be store in String data type Pass.

It should confirm the presence of STA in string first. If it is not present, do not enter into loop. If it exits, search for ID and Pass. Store it.

The code I used, seems to be not working. It doesn’t enter into loop, because it can’t search for STA, and even if it does, it does not search for ID and Pass

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>

char GetString[100];

String SSID;
String Pass;

String s = "HTTP/1.1 200 OK\r\nConnection: close\r\nContent-Length: 0\r\n\r\n";

WiFiServer server(80); //Initialize the server on Port 80

void setup()
{
  Serial.begin(115200); //Start communication between the ESP8266-12E and the monitor window
  WiFi.mode(WIFI_AP); //Our ESP8266-12E is an AccessPoint
  WiFi.softAP("Hello_IoT", "12345678"); // Provide the (SSID, password); .
  server.begin(); // Start the HTTP Server

  IPAddress HTTPS_ServerIP = WiFi.softAPIP(); // Obtain the IP of the Server
  Serial.print("\n");
  Serial.print("Server IP is: "); // Print the IP to the monitor window
  Serial.println(HTTPS_ServerIP);
}


void loop()
{
  WiFiClient client = server.available();
  if (!client) {
    return;
  }
  //Looking under the hood
  Serial.println("Somebody has connected :)");

  String incoming = client.readStringUntil('\r');
  Serial.println(incoming);
  incoming.toCharArray(GetString, 100);

  char *get = strtok(GetString, " ");
  char *request = strtok(NULL, " ");
  char *rtype = strtok(NULL, " ");

  Serial.print("\n");
  Serial.print("GetString :");
  Serial.println(GetString);

  Serial.print("\n");
  Serial.print("Request :");
  Serial.println(request);

  Serial.print("\n");
  Serial.print("Rtype :");
  Serial.println(rtype);

  if (request != NULL)
  {
    char *part = strtok(request, "/");
  
    while (part)
    {
      if (!strcmp(part, "STA"))
      {
        if (!strncmp(part, "ID=", 3))
        { // We have the ID
          SSID = String(part + 3);
          Serial.print("\n");
          Serial.print("SSID: ");
          Serial.print(SSID);
 
        }
 
        if (!strncmp(part, "Pass=", 5))
        { // We have the password
          Pass = String(part + 5);
          Serial.print("\n");
          Serial.print("PWD: ");
          Serial.print(Pass);
        }
      }
      else
      {
          Serial.print("\n");
          Serial.print("Not Found");
      }
      part = strtok(NULL, "/");
 
    }
  }
}

Your code won't work as you don't progress the parsing when you find STA

Your while loop will find STA and then if (!strncmp(part, "ID=", 3)) fails because you still point at STA, and if (!strncmp(part, "Pass=", 5)) fails because you still point at STA. you arrive at the end of the loop, you get to the next token with part = strtok(NULL, "/"); and go back up to check again agains STA... but this time it' no longer STA, it's ID=... but you don't enter the if clause because it's not STA...

long story short, you don't parse the string in the right way...

And STOP using Strings with a capital S. use char arrays

Can you suggest me any other way of doing this? Please.

J-M-L:
Your code won't work as you don't progress the parsing when you find STA

Your while loop will find STA and then if (!strncmp(part, "ID=", 3)) fails because you still point at STA, and if (!strncmp(part, "Pass=", 5)) fails because you still point at STA. you arrive at the end of the loop, you get to the next token with part = strtok(NULL, "/"); and go back up to check again agains STA... but this time it' no longer STA, it's ID=... but you don't enter the if clause because it's not STA...

long story short, you don't parse the string in the right way...

Set a Boolean to true when you find STA
don't nest your ifs, you can have else clauses
At the end of your while loop if the Boolean is true you will likely have ID and Pass set up as well.