Professional Documents
Culture Documents
ravi@valetron.com (mailto:ravi@valetron.com)
(/)
Page 1 of 2
This article is about showing you how to get the contents of a web page from and upload a
file to a web server using HTTP GET and POST methods. SIM900 GSM module provides a set
of AT commands which can be used for getting the contents of a web page and posting
variables and files to the web server through a GPRS connection.
pycom.io OPEN
Before you begin make sure your SIM900 GSM module has acquired the network and it is
ringing when you make a call to it. Then test the basic AT commands and then proceed
further.
Once you are ready, you can start by first setting up the GPRS connection as follows,
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 1/18
9/2/2018 SIM900 GPRS HTTP AT Commands
Text in RED is typed by me and text in GREEN is the response from SIM900 module.
We will get the content of the webpage from my old website at the url
http://www.marsinnovations.in/testout.php,
(http://www.marsinnovations.in/testout.php,) which is a simple web page that puts out some
dummy text as shown below. You can retrieve any webpage you want.
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands
2/18
9/2/2018 SIM900 GPRS HTTP AT Commands
We were allocated a IP address and now we can proceed by enabling the HTTP mode
AT+HTTPINIT
OK
OPTIONAL, ONLY IF URL is HTTPS or SSL enabled: Also Remove the http:// part in the
HTTPPARA="URL",xxxx command
AT+HTTPSSL=1
OK
Start by setting up the HTTP bearer profile identifier
AT+HTTPPARA="CID",1
OK
Set the url to the address of the webpage you want to access
AT+HTTPPARA="URL","http://marsinnovations.in/testout.php"
OK
Start the HTTP GET session, by giving this command
AT+HTTPACTION=0
OK
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 3/18
9/2/2018 SIM900 GPRS HTTP AT Commands
The below output from module indicates it has read 654 bytes of data and the response of the HTTP GET request is 200,
which means success
+HTTPACTION:0,200,654
The below command tells the module that we want to read the received data
AT+HTTPREAD
The below is the data read from the webpage
+HTTPREAD:654
Logged Meter Readings:<br>Date Time: Current Voltage Temp.<br>
<br>Mon May 19 23:56:12 2014 :485683465429634
<br> :485683465429634
<br>Tue May 20 00:00:13 2014 :948598437599980
<br>Tue May 20 00:04:41 2014 :948598437599980
<br>Tue May 20 00:24:39 2014 :9485
<br>Tue May 20 00:25:37 2014 :9485
<br>Tue May 20 00:40:50 2014 :23423
<br>Wed May 21 00:07:19 2014 :948598437599980
<br>Wed May 21 00:43:20 2014 :34234324
<br>Wed May 21 00:47:15 2014 :34234324
<br>Wed May 21 11:12:10 2014 :34234324
<br>Wed May 21 15:23:22 2014 :34234324
<br>Wed May 21 15:28:07 2014 :564575676
<br>Wed May 21 15:38:06 2014 :564575676
<br>Wed May 21 15:43:53 2014 :564575676<br>
OK
The contents above are the contents of the webpage shown before.
Sort by Best
Recommend ⤤ Share
LOG IN WITH
OR SIGN UP WITH DISQUS ?
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 4/18
9/2/2018 SIM900 GPRS HTTP AT Commands
Name
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 5/18
9/2/2018 SIM900 GPRS HTTP AT Commands
Hi Venkat,
Thank you :)
By default it will be in text or ascii format unless you
encode it.
I dont understand where the data is getting converted to
binary. Could you please explain more?
△ ▽ • Reply • Share ›
sprintf(_buffer, "#;%s;%d-%d-
%d;%d:%d;%f;%f",imei,(uint16_t)rtc.year,
(uint16_t)rtc.month,(uint16_t)rtc.date,
(uint16_t)rtc.hour,(uint16_t)rtc.min,temp,humid);
HTTP_Post(_buffer, responseLength);
---------------------------acebdf13572468
Content-Disposition: form-data; name="fieldNameHere";
filename="nogithub.txt"
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 6/18
9/2/2018 SIM900 GPRS HTTP AT Commands
Content-Type: text/plain
QWERTY
---------------------------acebdf13572468--
Hi Naresh,
Please post your tech queries here.
http://www.embeddedadvice.com/
We can discuss
△ ▽ • Reply • Share ›
Hi Daniel,
Please post tech queries here,
http://www.embeddedadvice.com/
We can discuss.
△ ▽ • Reply • Share ›
Hi Venkat,
Regards,
Ravi
△ ▽ • Reply • Share ›
#define pinPowerSIM900 9
TinyGPS gps;
SoftwareSerial sGPS(10,9);
void setup() {
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 9/18
9/2/2018 SIM900 GPRS HTTP AT Commands
void setup() {
pinMode(pinPowerSIM900, OUTPUT);
digitalWrite(pinPowerSIM900,LOW);
see more
△ ▽ • Reply • Share ›
see more
△ ▽ • Reply • Share ›
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 11/18
9/2/2018 SIM900 GPRS HTTP AT Commands
Thanks in advance.
△ ▽ • Reply • Share ›
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","mtnirancell"
AT+SAPBR=1,1
AT+SAPBR=2,1
AT+SAPBR=0,1
//get
AT+HTTPINIT
AT+HTTPPARA = "CID",1
AT+HTTPPARA="URL","www.sim.com"
AT+HTTPACTION=0
AT+HTTPREAD
AT+HTTPTERM
△ ▽ • Reply • Share ›
_______________________________________________
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"CONTYPE","GPRS"
OK
AT+SAPBR=3,1,"APN","internet.com"
see more
△ ▽ • Reply • Share ›
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 13/18
9/2/2018 SIM900 GPRS HTTP AT Commands
py
OK
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","http://posttestserver.com/p..."
OK
AT+HTTPPARA="CONTENT","multipart/form-data; boundary=---
-WebKitFormBoundaryvZ0ZH
ShNAcBABWFy"
OK
AT+HTTPDATA=192,10000
DOWNLOAD
ERROR
△ ▽ • Reply • Share ›
D h Bi i
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 14/18
9/2/2018 SIM900 GPRS HTTP AT Commands
Deepanshu Biyani • a year ago
i am getting error in these commands,
Set the url to the address of the webpage you want to post to
AT+HTTPPARA="URL","http://posttestserver.com/p..."
ERROR
△ ▽ • Reply • Share ›
AT+CGATT=1
OK
AT+SAPBR=3,1,"Contype","GPRS"
OK
AT+SAPBR=3,1,"APN","airtelgprs.com"
OK
AT+SAPBR=1,1
OK
AT+SAPBR=2,1
+SAPBR: 1,1,"100.100.97.117"
see more
△ ▽ • Reply • Share ›
back to top
Facebook (http://www.facebook.com/sharer.php?u=https://www.raviyp.com/embedded/194-
sim900-gprs-http-at-commands)
Twitter (http://twitter.com/share?url=https://www.raviyp.com/embedded/194-sim900-gprs-http-
at-commands&text=SIM900%20GPRS%20HTTP%20AT%20Commands)
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 15/18
9/2/2018 SIM900 GPRS HTTP AT Commands
(https://plus.google.com/share?url=https://www.raviyp.com/embedded/194-sim900-gprs-http-at-
commands)
(http://www.linkedin.com/shareArticle?mini=true&url=https://www.raviyp.com/embedded/194-
sim900-gprs-http-at-commands)
(https://plus.google.com/102969188306424582103)
Email:ravi@valetron.com
(mailto:ravi@valetron.com)
Find us on Google+
(https://plus.google.com/104907583360502363516)
HIRE ME FOR YOUR PROJECT AS A
FREELANCER
Ravi Pujar
YouTube 2K
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 16/18
9/2/2018 SIM900 GPRS HTTP AT Commands
Subscribe
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 17/18
9/2/2018 SIM900 GPRS HTTP AT Commands
Embedded World
7.1K likes
Like Page
https://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands 18/18