-1

I am using ESP8266WiFi library for a NodeMCU project where the user has to fill a form and submit the data through GET. Now I want to read the Arguments such as 192.168.1.1/submit?Name=john All I need is to get the arguments after 192.168.1.1?

what method of ESP8266Wifi library would return these arguments?

  • 1
    There are thousands of examples of how to build a web server on the ESP8266, including examples provided by the ESP8266WebServer library. If you spent a few minutes using Google you'd easily find them. – romkey Sep 02 '20 at 21:28
  • ESP8266Wifi doesn't know anything about the HTTP protocol. there are ESP8266HttpClient and ESP8266WebServer libraries for HTTP – Juraj Sep 03 '20 at 08:43

1 Answers1

0
void handlePing() {
  if (server.arg("ip")== "") {
    Serial.println("No IP provided to ping");
    server.send(400, "text/plain", "Try /ping?ip=1.2.3.4");

    return;
  }

  Serial.print("Pinging ");  
  Serial.print(server.arg("ip"));

  if(pinger.Ping(server.arg("ip"))){
    Serial.println("- Success");
    server.send(200, "text/plain", "SUCCESS");
  } else {
    Serial.println("- Failed");
    server.send(200, "text/plain", "FAILURE");
  }
}

server.on("/ping", handlePing);
omfaer
  • 184
  • 3
  • 16