Unable to submit a POST request with ESP8266
Posted: Mon Mar 06, 2017 5:01 pm
Hello,
I am current working on a project where I need to log into a network in order to access the web from the ESP8266. To log in, I can access a web page where I can enter my username and password. I was thinking of utilizing a POST request in order to do for the specific login page, but I am unable to get POST to work.So far I have been experimenting with another WiFi network that I am able to access and communicate through. I am using Software serial and utilizing an Arduino to talk to the ESP8266. I have tried submitting a POST request to a simple website with a database to see if it works, but my code unfortunately does not. Alhtough, I am to submit using GET with no problem. Here is my line of code for the POST request.
I am current working on a project where I need to log into a network in order to access the web from the ESP8266. To log in, I can access a web page where I can enter my username and password. I was thinking of utilizing a POST request in order to do for the specific login page, but I am unable to get POST to work.So far I have been experimenting with another WiFi network that I am able to access and communicate through. I am using Software serial and utilizing an Arduino to talk to the ESP8266. I have tried submitting a POST request to a simple website with a database to see if it works, but my code unfortunately does not. Alhtough, I am to submit using GET with no problem. Here is my line of code for the POST request.
Code: Select all
esp.println("AT+CIPSTART=0,\"TCP\",\"theWebsite\",80");
delay(1000);
esp.println("AT+CIPSEND=0,200");
delay(1000);
esp.println("POST /example.php HTTP/1.0\r\nHost: theWebsite\r\nAccept:*/\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: 26\r\n\r\nfirstName=12&lastName=45\r\n\r\n");