[SOLUTION] Forgive me for reviving such an old thread, but I have struggled with this for several hours now and couldn’t find any decent references for doing an HTTP POST without embedding the POST data in the URL.
Here is what I believe to be a better approach. There is no such example in any official documentation I could find, but it seems to work. I added the solution here for future reference, as this is the first relevant page I found during my own search.
- Start IP Stack
AT+WIPCFG=1
OK
- Open GPRS bearer
AT+WIPBR=1,6
OK
- Set APN (replace “internet” with your APN)
AT+WIPBR=2,6,11,"internet"
OK
- Start GPRS bearer
AT+WIPBR=4,6,0
OK
- Connect TCP socket to remote server on port 80 in HTTP mode (substitute your URL, but you can use httpbin.org for testing)
AT+WIPCREATE=5,1,"httpbin.org",80
OK
+WIPREADY 5, 1
- Do HTTP POST (adjust the content type, content length and other header data to suit your needs)
AT+WIPFILE=5,1,4,"http://httpbin.org/post","","","Accept","*/*","Accept-Encoding","deflate","Content-Type","application/json","Content-Length","9"
OK
CONNECT
(NB: Now the modem is in data mode and does not echo bytes sent over UART)
It works![ETX]
(NB: [ETX] is the Unicode U+0003 character)
{
"url": "http://httpbin.org/post",
"json": null,
"data": "It works!",
"form": {},
"origin": "10.xxx.xx.xxx",
"headers": {
"Content-Type": "application/json",
"Accept": "*/*",
"Accept-Encoding": "deflate",
"Connection": "close",
"Content-Length": "9",
"Host": "httpbin.org",
"Transfer-Encoding": "chunked"
},
"files": {},
"args": {}
}
+WIPFILE: 5,1,4,200,"OK"
OK
- Close TCP socket
AT+WIPCLOSE=5,1