//This code is for an ESP32 board that connects to a WiFi network and sets up a web server. // It listens for POST requests on the "/uri" endpoint and expects a parameter named "uri" in the request body. // When a request is received, it prints the URI to the Serial Monitor and sends a response back to the client. //The Flutter app can send a POST request to the ESP32's IP address with the URI as a parameter in the request body. #include #include const char* ssid = "SSID_NAME"; // Replace with your network SSID const char* password = "SSID_PASSWORD"; // Replace with your network password WebServer server(80); void handleUriPost() { if (server.hasArg("uri")) { String uri = server.arg("uri"); Serial.println("Received URI: " + uri); server.send(200, "text/plain", "URI received: " + uri); } else { server.send(400, "text/plain", "Missing 'uri' parameter"); } } void setup() { Serial.begin(115200); WiFi.begin(ssid, password); Serial.print("Connecting to WiFi..."); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println("\nConnected! IP address: "); Serial.println(WiFi.localIP()); server.on("/uri", HTTP_POST, handleUriPost); server.begin(); Serial.println("HTTP server started"); } void loop() { server.handleClient(); }