Learn about generating and sending HTTP POST Request from ESP8266. The POST method is the type of HTTP request method used to request data from the server or send data to the server. For this are going to use ESP8266WiFi and ESP8266WebServer library. So, let’s start.
Handle HTTP POST Request
First, we made a login page for handling HTTP POST Request with ESP8266. Compared username and password credentials and if it is valid, it will show login successful else it will show invalid credentials. Let’s look at the code of ESP8266.
Firstly, we initialized the webserver on port 80 in ESP8266. Connect ESP8266 to WiFi with given credentials. Made a login webpage on homepage URI. After that, made a function to handle the login POST request. Username “User1” and “Pass1” matches, it will show Login Successful. Similarly, when entering the wrong credentials, it will show Invalid Credentials. So, this is our code for ESP8266.
Finally, upload the above-given code to the ESP8266 WiFi module/NodeMCU. Go to the ESP8266 local IP, (you can get it from Serial) it will show username and password block with a login button. Also, enter “User1” in the username and “Pass1” in password block and press login. Similarly, It will show Login Successful on the display.
This is how Generating HTTP POST request with the ESP8266 WiFi Module.
Learn more about Programming ESP8266 with Arduino UNO.