Chat freely about anything...

User avatar
By rudy
#55821 As far as I know the ESP8266 as a server can handle post method. I took a look at a source file and that is what I found. I don't have time to find you an example though. (at work)
User avatar
By miranthajayathilaka
#55939 I'm trying esp8266 post request to try and send two variable values through URL. The post request i have is shown below.

client.print(String("POST ") + url +
" HTTP/1.1\r\n" + "Host: " +
host + "\r\n" + "User-Agent: Arduino/1.0\r\n" + "Cache-Control: no-cache\r\n" +
"Content-Type: application/x-www-form-urlencoded" + "\r\n" + "Connection: close\r\n\r\n" +
"Content-Length: " + post.length() + "\r\n" + post );
The post data is like this.

String post = "number=1&status=OFF";
I'm using XAMPP to host the webpage. Everything seems to work fine but after execution what i receive is this on the php page.

Notice: Undefined index: number in C:\xampp\htdocs\pumpupdate.php on line 3

Notice: Undefined index: status in C:\xampp\htdocs\pumpupdate.php on line 4
which means the the $_GET commands in the php script don't reveive the variables sent to the page's URL. When i tried manually updating the url it worked fine, which i concluded as the php file working properly.

Please advice. really appreciate the help. Thanks.