Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By gamecompiler
#41647 Hi, i would like to get the complete POST Payload posted by a webform to the server.
I use the ESP8266 FSBrowser example.
But with following additions:

Code: Select allvoid testfunc(){
  //Outch, there is no argument inside if zero.
  if(server.args() == 0) return server.send(500, "text/plain", "BAD ARGS");

  for (int x=0; x <= server.args(); x++) {
    //print all arguments received in POST payload
    DBG_OUTPUT_PORT.println(server.arg(x));
  }
  //Print out the amount of arguments received in POST payload
  DBG_OUTPUT_PORT.println(server.args());
  //Make the browser happy, send him something
  server.send(200, "text/plain", "");
}


and this as callback definition located at the setup loop.

Code: Select allserver.on("/test", HTTP_POST, testfunc);


I just get the values of the Payload variables.
I would like to get the names of the variables.

A example of my POST request is here:
Code: Select allnickname: "mynickname"
team: "red"


The code displayed above only outputs:
Code: Select all2
mynickname
red


But i would like to also get nickname and team

Thanks in advance
Last edited by gamecompiler on Mon Feb 22, 2016 1:51 pm, edited 1 time in total.
User avatar
By gamecompiler
#41677
eduperez wrote:After a quick look to the source code (https://github.com/esp8266/Arduino/blob ... ebServer.h), looks like "arg(int i)" returns the value of each argument, and "argName(int i)" returns the name of each argument.


Thank you very much ! That was the solution !