Search code examples
at-commandmodemcellular-network

telit modem gets 400 bad request on post using AT commands


I can't seem to get the telit (HE910-NAG) cellular modem to do an http post following the examples from the data sheet. The parameter I am sending is "test=test". No matter what I do I am getting 400 Bad Request. Below are my at commands. I am sending the post parameter once getting ">>>". Get requests are working fine.

This has caused me to grow balder.

AT#SGACT=1,1


#SGACT: 33.231.2.193

OK

AT#HTTPCFG=0,"httpbin.org",80,0,,,0,120,1

OK

AT#HTTPSND=0,0,”POST /post HTTP/1.1”,9,0


>>>

OK




#HTTPRING: 0,400,"",0

AT#HTTPRCV=0



<<<
Server: nginx
Date: Tue, 01 Nov 2016 23:15:43 GMT
Content-Type: text/html
Content-Length: 166
Connection: close

<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>


OK

Solution

  • I never could get this to work. I ended up doing this instead. It worked great even though its not as short. On a side note, I tried this earlier and couldn't get it to work because I had quotes around the address in the AT#SD command. I had quotes because the example had quotes.

    AT#SD=1,0,80,httpbin.org
    
    POST /login HTTP/1.1
    Host: httpbin.org
    Content-Type: application/x-www-form-urlencoded; charset=utf-8
    Content-Length: 9
    
    test=test