Go Down

Topic: POST HTTP with AT Commands (Read 13 times) previous topic - next topic

Luan

Hi All

Hope you are doing well

I am trying to post an HTTP URL with data to a website.
I tested it first on Cosm and it works on Cosm, but I want to emulate an entry in the address bar of IE.

If I type the following http://www.mysite.com/test/gettempdata.php?TI=12.1&TO=22.2&TR=33.3 in to the address bar of internet explorer it updates the MySQL DB and shows the DATA on the page.

How do I do the same with AT commands?
I am not sure if there need to be extra ""

I am using a SIM900 with Software Serial witch has a 64 Byte buffer.

I have tried the following:
Code: [Select]

AT+SAPBR=3,1,"APN","internet"
OK

AT+CIFSR
41.18.131.13

AT+CIPSPRT=0
OK

AT+CIPSTART="TCP","http:/www.mysite.com","80"
OK

CONNECT OK

AT+CIPSEND
http:/www.mysite.com/test/gettempdata.php?TI=25.5&TO=20.9&TR=16.7
SEND OK

AT+CIPCLOSE
AT+CIPSHUT=0

CLOSE OK

and

Code: [Select]

AT+CSQ
AT+CGATT?
AT+SAPBR=3,1,"CONTYPE","GPRS"

+CSQ: 12,0
AT+SAPBR=3,1,"APN","internet"
OK

AT+HTTPPARA="URL","http:/www.mysite.com/test/gettempdata.php?TI=25.5&TO=20.9&TR=16.7"
OK

AT+HTTPACTION=0
OK

+HTTPACTION:0,603,0
AT+HTTPREAD
OK


When I use HTTPPARA I do not get  response, if I use HTTPPARA with www.google.com I get a response when I run HTTPREAD

Any help would be appreciated.
Please let me know if I need to post the code as well.

Thank you in advanced

Regards

Luan

wolfgang42

Based on a quick reading of the datasheet, I don't think the SIM900 supports HTTP. You'll have to establish a TCP connection and then manually negotiate the HTTP.

Luan

Hi Wolfgang

Thank you for the reply.

Do any one of you know where I can find an example on the server side to accept POSTs with PHP, similar than Cosm.
I want to store the data on my own site, Cosm only keeps data for 3 months.

Thank you

In advanced

ttfn

Luan

Luan

#3
Aug 02, 2012, 02:22 pm Last Edit: Aug 02, 2012, 02:24 pm by Luan Reason: 1
Hi All

We got it workig:

Here is the AT comands + output:

Code: [Select]

AT+SAPBR=3,1,"APN","internet"
OK

AT+CIFSR
41.15.5.196

AT+CIPSPRT=0
OK

AT+CIPSTART="TCP","www.Mysite.com","80"
OK

CONNEC

AT+CIPSEND
PUT /test/gettempdata.php?TI=19.12&TO=21.75&TR=32.63 HTTP/1.1
Host: www.Mysite.com
Connection: keep-alive


AT+CIPCLOSE
AT+CIPSHUT=0

CLOSE OK



Thank you  :)

garreb

Hi

Can you please post some code in order to execute this AT command

AT+CIPSEND
PUT /test/gettempdata.php?TI=19.12&TO=21.75&TR=32.63 HTTP/1.1
Host: www.Mysite.com
Connection: keep-alive


BR

Go Up