HTTP POST does not work in esp-idf, it does work in arduino..
Posted: Tue Jan 01, 2019 7:18 pm
Hey all,
To start I have used the search function and read through the problems from other posts, the most similar one was this https://www.esp32.com/viewtopic.php?t=843 tried the same thing but it seemed like an old example and couldn't get it to work.
My issue is that I am working through http_request_example, and I change the code to suit my needs and it connect to my website easily, but I get a HTTP 400 error, and a esp errno of 128 (I believe is SSL?)
here is what I am sending as the post request:
here is output from IDF
any help will be greatly appreciated. I am also not using https and my site does not have ssl currently. as mentioned in title, it works fine in arduino, and GET works as well.
To start I have used the search function and read through the problems from other posts, the most similar one was this https://www.esp32.com/viewtopic.php?t=843 tried the same thing but it seemed like an old example and couldn't get it to work.
My issue is that I am working through http_request_example, and I change the code to suit my needs and it connect to my website easily, but I get a HTTP 400 error, and a esp errno of 128 (I believe is SSL?)
here is what I am sending as the post request:
Code: Select all
POST http://xxx.com/xxx/Device04/Test2.php HTTP/1.1
Host: xxx.com
User-Agent: ESP32HTTPClient
Connection: close
Accept-Encoding: identity;q=1,chunked;q=0.1,*;q=0
Content-Type: application/x-www-form-urlencoded
Content-Length: 58
t=10&h=10&t2=10&s=(10,10)&password=Password&table=Device05
Code: Select all
I (561465) Test: Connected to AP
I (561465) Test: DNS lookup succeeded. IP=
I (561465) Test: ... allocated socket
I (561505) Test: ... connected
I (561505) Test: ... socket send success
I (561505) Test: ... set socket receiving timeout success
HTTP/1.1 400 Bad Request
Server: nginx/1.14.1
Date: Tue, 01 Jan 2019 08:00:44 GMT
Content-Type: text/html
Content-Length: 173
Connection: close
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.14.1</center>
</body>
</html>
I (561565)Test: ... done reading from socket. Last read return=0 errno=128