[Solved]ESP8266WebServer POST Payload name of data sent
Posted: Mon Feb 22, 2016 5:02 am
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:
and this as callback definition located at the setup loop.
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:
The code displayed above only outputs:
But i would like to also get nickname and team
Thanks in advance
I use the ESP8266 FSBrowser example.
But with following additions:
Code: Select all
void 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 all
server.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 all
nickname: "mynickname"
team: "red"
The code displayed above only outputs:
Code: Select all
2
mynickname
red
But i would like to also get nickname and team
Thanks in advance