Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

POST HTTP command to update data into web server using GPRS

Status
Not open for further replies.

beema

Newbie level 5
Newbie level 5
Joined
May 22, 2008
Messages
9
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,283
Visit site
Activity points
1,362
Hi,

I am using SIM300 for GPRS connection. I want to post data on to web server using POST command from Hyperterminal. Is there any alternative to post te data on to web server. Please help how to send

Regards
Vishnu
 

how to upload data over web server using gprs

Hi,

Finally i could able to post data using POST command. You can upload data into web server using POST or even GET command. All depends on the server (server may accept data by POST or GET command). To know what server accepts using sniffer. For that i tried below link to download.

https://www.wireshark.org/download.html

Regarding POST command i tried with the below link.

**broken link removed**

First i sniffed the data transmitting between my PC and server using above link.
Based on that i tried the same using AT commands from HyperTerminal.

at+cipstart=”TCP”,”216.128.29.26”,”80”
POST **broken link removed** HTTP/1.1^m^j
Host: www.w3schools.com^m^j
Content-Type: application/x-www-form-urlencoded^m^j
Content-Length: 10^m^j^m^j
Celsius=32^z (Nothing to be pressed and even without gaps)

Note: ^m is Carrier return
^j is Line Feed
^z is Ctr-Z
and ^ is the symbol from Keyboard.

Regards
Vishnu
 
Re: POST HTTP command to update data into web server using G

Hi

I was not able to POST data using HTTP POST method ... Hence i followed the method which you had mentioned... & its working

Thank You
 

Hello

i use sim900 11.0 .
in the middle of this command my modem show this message
sim 900 11.0
error

Does this message because this modem is not supported this command??

please help me

i need it

thanks alot
 

Hi. Is this mandatory only use ip address like at+cipstart=”TCP”,”216.128.29.26”,”80”. Can i use for example : at+cipstart="TCP","http://www.mydomainname.com","80"?
 

Alright thank you.just a little question. Did you try post data to your php via domainname. Can you test for me if at one's disposal.
 

i cant send data to the server using POST http request..

POST update.php HTTP/1.1
Host: .com
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Content-Type: text/html
Referer: https://xxx.com/xxxx/reg.php
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:22.0) Gecko/20100101 Firefox/22.0
name:=riy&submit=submit<LF><LF><SUB>

the response from the server is

SEND OK<CR><LF>
+IPD353:HTTP/1.1 200 OK<CR><LF>
Date: Thu, 18 Jul 2013 09:42:50 GMT<CR><LF>
Server: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635<CR><LF>
X-Powered-By: PHP/5.3.8<CR><LF>
Keep-Alive: timeout=5, max=100<CR><LF>
Connection: Keep-Alive<CR><LF>
Transfer-Encoding: chunked<CR><LF>
Content-Type: text/html<CR><LF>
<CR><LF>
16<CR><LF>
welcome name: submit<CR><LF>
+IPD5:0<CR><LF>
<CR><LF>
<CR><LF>
CLOSED<CR><LF>


but i cant see what i send..
 

Re: how to upload data over web server using gprs

Hi,

Finally i could able to post data using POST command. You can upload data into web server using POST or even GET command. All depends on the server (server may accept data by POST or GET command). To know what server accepts using sniffer. For that i tried below link to download.

https://www.wireshark.org/download.html

Regarding POST command i tried with the below link.

**broken link removed**

First i sniffed the data transmitting between my PC and server using above link.
Based on that i tried the same using AT commands from HyperTerminal.

at+cipstart=”TCP”,”216.128.29.26”,”80”
POST **broken link removed** HTTP/1.1^m^j
Host: www.w3schools.com^m^j
Content-Type: application/x-www-form-urlencoded^m^j
Content-Length: 10^m^j^m^j
Celsius=32^z (Nothing to be pressed and even without gaps)

Note: ^m is Carrier return
^j is Line Feed
^z is Ctr-Z
and ^ is the symbol from Keyboard.

Regards
Vishnu


Hi Vishnu, those symbols with letters which you wrote at the end. Do I send them as - is i.e, does the SIm900 module understand these symbols and letters such as ^m
OR
you pressed these key combinations after typing at hyperterminal ?

Thanks,
 

Re: how to upload data over web server using gprs

Hi Vishnu, those symbols with letters which you wrote at the end. Do I send them as - is i.e, does the SIm900 module understand these symbols and letters such as ^m
OR
you pressed these key combinations after typing at hyperterminal ?

Thanks,


I figured out a couple of other things.

I am using a arduino with seeed gprs modem SIM900.

1. When you send
AT+HTTPDATA=num,timeout
and then send text after it, the length of text you are sending MUST match the 'num' value otherwise you will get an ERROR from the modem.

2. HTTP GET works just fine by following the steps given in SIM900 app note on HTTP.

3. To get HTTP POST working, you have to cheat the system a bit. POST the values along with the url and let the server page handle it using GET methods. Not the right way to do it but hey! its a workaround to this problem.

4. If you still want it the right way, then follow the methods listed below:-

Created a list of command strings


Code C - [expand]
1
2
3
4
5
6
7
8
9
char *sendmsgWork[] = {
"AT+CIPSTART=\"TCP\",\"68.232.44.251\",\"80\"",
"AT+CIPSEND",
"POST **broken link removed** HTTP/1.1",
"Host: www.w3schools.com",
"Content-Type: application/x-www-form-urlencoded",
"Content-Length: 10\r\n",
"Celsius=32"
};



NOTE: when you try this out, do not select and copy+paste the above. There is high possibility of the copy command copying some special characters which aren't visible, so advisable to type the whole thing out. Also be careful about the double qoutes, hyphens, slashes because they are not the keyboard symbols when copied from the web. It wasted a lot of my time to figure this out.

After you send out the first command, wait till you receive OK twice. Then send the next command and following HTTP POST headers etc. Give a 100ms delay between each. At the end you need to send Hex 0x1A to complete the send from arduino to modem.

Thereafter Modem will transfer the data to server and wait for server's response. Below is an example code which does this.


PLEASE MAKE SURE YOU REMOVE THE "" and "[\url]" tags from the code b...[url]https://www.edaboard.com/threads/126547/

https://openenergymonitor.org/emon/node/1432

Postman extension for chrome helped me test out basic GET/POST commands

**broken link removed**

https://stackoverflow.com/questions/15975051/error-httpaction0-601-0

https://www.edaboard.com/threads/281314/


Hope it helps...

And Many many many many thanks to all those who helped.
 

My HTTP GET works fine but problems with POST.
I am having trouble in POST data to the server.
So, can you explain a bit " POST the values along with the url and let the server page handle it using GET methods." I couldn't understand this line. So, can you briefly explain this line.
what changes do I need to do in following command which is use for GET
AT+HTTPPARA="URL","www.mydomain.com/index.php?var_a=123245"
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top