ESP8266WebServer server(80);
server.on("/config", handle_config);
//////
void handle_config(){
//I want to intercept a json telegram from my client here
//I will store it in a buffer and pass it to a JSON parsing function
}
Moderator: igrr
if (server.args() > 0 ) {
if (server.hasArg("password")) {
pw = webserver.arg("password");
Serial.println(pw);
}
www.on("/saverulesxml", HTTP_POST, www_XMLrules, NULL, www_bodyXMLrules);
then www_bodyXMLrules (change the name ) is invoked periodically as data arrive to webserver...
EDIT!!! - Maybe i'm wrong and You can handle this even in standard core - try to study HTTPUpload object... (anyway i'm using Async - it's faster, supports multiple connections and websockets in one port...)
martinayotte wrote:The server receive the post as arguments, for example :Code: Select allif (server.args() > 0 ) {
if (server.hasArg("password")) {
pw = webserver.arg("password");
Serial.println(pw);
}
Are these like the headers in a POST?
Pablo2048 wrote:IMHO this can not be done in standard Arduino Core library. You have to use AsyncWebserver and hook receiving callback like thisCode: Select allwww.on("/saverulesxml", HTTP_POST, www_XMLrules, NULL, www_bodyXMLrules);
then www_bodyXMLrules (change the name ) is invoked periodically as data arrive to webserver...
That seems surprising, I can't imagine it's an exceptionally uncommon thing to want to do. Even if I could just get all of the raw data sent by the client I'm happy to parse it myself. Any way to just get EVERYTHING in the POST?