SIM800L (or similar) HTTP POST using AT commands

Hello everyone!

I'm in need for help regarding posting data from arduino to server vis SIM800L GSM module. I believe that posting is the same as in some other modules, so any help will do.

I'm having problems understanding a particular AT command, but first I'll describe the problem. Using the code I found here (simple serial communication) http://www.ayomaonline.com/programming/quickstart-sim800-sim800l-with-arduino/ I am able to communicate with the module, and through Serial monitor I am able to give oredrs to the module, and subsequently, I can send SMS messages, read data from the web, even make phonecalls. I am telling you this just so you are sure that everything is connected properly.

The only thing I am not able to do is to post data to the server. Anyway, servers are not really my thing, a friend has put up a server that "listens" to data made by post request and stores them to a .txt file. We are able to fill the txt document through web browser, so I guess on that side, everything is also set up properly. Now, we are getting to the problem. Below is the series of AT commands I am sending to SIM800L through serial monitor and its response:

AT
OK

AT+SAPBR=3,1,"APN","data given by my provider"
OK

AT+SAPBR=1,1
OK

AT+HTTPINIT
OK

AT+HTTPPARA="URL","http://mymsite.com/testdata"
OK

AT+HTTPPARA="CONTENT","application/x-www-form-urlencoded"
OK

now we get to the troubling part, I'll comment the AT commands:

AT+HTTPDATA=5,50000
using this command, I am telling the SIM module that I will be sending 5 bytes of information, and i have 50000ms (50s) of time to enter them. Its response is:
DOWNLOAD (now i start typing the data)
ABCDE (and then I hit enter)
OK

As far as I understand, now the buffer should contain these 5 bytes. And now, when I use the final command:

AT+HTTPACTION=1

OK

+HTTPACTION: 1,200,0

Here is the problem. The response 1,200,0 means:
1 - POST command (0 is for GET and 2 is for HEAD commands)
200 - HTTP status code meaning OK
0 - 0 bytes are posted (!!!) How? Shouldn't it be 5 bytes? I tried all kinds of commands but nothing worked.

Also, very important fact: the txt file really does get something from the module. We made the file to put a timestamp each time something is posted, and we get only an empty line and I think we should have got "ABCDE".

Any thoughts? I am doing something wrong but I can find out what. It's been bugging me for a while and it has become very frustrating :smiley:

Thanks in advance! :slight_smile: