-->
Page 1 of 1

HTTP POST "Bad Request"

PostPosted: Fri May 13, 2016 12:21 pm
by nate4495
Hallo!!

I am trying to get the ESP8266 to hookup to my server using HTTP POST request. I got GET to work with no problems. POST request is going through but keeps telling me that it was a "Bad Request" (?)

Here is the output from my code. The POST request is printed as it is sent, then the output of the request is printed (I starred out sensitive information). Is there something wrong with my syntax? Or something silly I forgot?? I don't know!! :?:

AT+CIPSTART=0,"TCP","107.***.*.137",80

0,CONNECT

OK

POST /r*******t.phtml HTTP/1.1
Host: t*********e.com
Content-Length: 88
user=popo&pw=1e*****************9f6e2&temp=-1766&humidity=-999&water=322&soil=35

ready for TCP


+IPD,0,545:HTTP/1.1 400 Bad Request
Date: Fri, 13 May 2016 17:07:56 GMT
Server: Apache/2.4.12
Content-Length: 372
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
Request header field is missing ':' separator.<br />
<pre>
user=popo&amp;pw=1e************e2&amp;temp=-1766&amp;humidity=-9</pre>
</p>
</body></html>
0,CLOSED


Thanks for any help!! :geek:

Re: HTTP POST "Bad Request"

PostPosted: Fri May 13, 2016 12:47 pm
by martinayotte
It looks like the header and body isn't separated by an empty line.
So, it chokes trying to parse your body as a header parameter.