In this post I am writing how to send a GET request using GSM Module with AT commands. It should work with any module and has been tested to work with Sim800 series (SIM800C-DS , SIM800A, SIM800H, SIM800L, SIM800C, SIM800 etc) and Sim900 series (SIM900, SIM900A, SIM900D, SIM900B) of modules from simcom.
You have to bring up GPRS connection before this obviously , which is not covered here in this post.
HERE ARE THE STEPS TO MAKE GET REQUEST
Initiate the HTTP service
AT+HTTPINIT > OK
Set the HTTP session.
AT+HTTPPARA=”CID”,1 > OK
Set the HTPP URL
at+httppara=”URL”,”google.com”
Start the session<
AT+HTTPACTION=0 > OK > +HTTPACTION:0,601,0
The above AT response code (601) for HTTP session start indicates that there is a network error. Then make sure that the PDP context is setup properly.
IF the HTTP session is successful, it should return code of ’200′,
AT+HTTPACTION=0 > OK > +HTTPACTION:0,200,4
Above HTTP GET request is sucessful and it returned 4 bytes.
To read the data of the HTTP server,
AT+HTTPREAD > +HTTPREAD:4 > test > OK
To terminate the HTTP service,
AT+HTTPTERM > OK
UPDATE:
Sometimes a 601 Error code is received in response. @Bruno Lewin shared a link to a StackOverFlow Answer about the issue and I feel that I should include it here as well
Here are the minimum setup commands that have worked for me (based on trial/error and searching around on the internet).
AT+SAPBR=3,1,"APN","wap.cingular" AT+SAPBR=1,1
The correct value for the APN may be different for you, depending on your network and service provider.
Status codes above 600 (and some in the 500 range) are unassigned in the HTTP standard. In the AT command manual for the SIM908, status meanings are given in the notes on the
HTTPACTION
command:600 Not HTTP PDU 601 Network Error 602 No memory 603 DNS Error 604 Stack Busy
You can query the bearer connection status of CID 1 with
AT+SAPBR=2,1
and the related parameters withAT+SAPBR=4,1
. You can also check that you’re attached to the GPRS network withAT+CGATT?
. If everything indicates that you are connected and you are still getting a 601 status code, then check that your service plan has data and that it hasn’t run out. I have found that even when my account has a few hundred k of data showing on the balance that I start to get a 601 status until I add more data to my prepaid phone plan. If the SIM module has been on the whole time and you add more data, you’ll need to close and re-open your connection (AT+SAPBR=0,1
followed byAT+SAPBR=1,1
) and then yourHTTP*
commands will start working again without having to set theHTTPPARA
settings again and without having to restart withHTTPINIT
.
i need to upload temperature and some other sensors data to a domain at 000webhost.com i tried to use both httpget and httppost commands with sim900 connected to rpi3 but i always get error 603 that error had appeared once for me previously and was solved by restarting the module ,now it does not want to disappear what may be the problem ? putting in consider that the sim credit and Internet data both are recharged
Hi,
600 series of http error codes are not assigned in the standard.
In the AT command manual for the SIM900, status meanings are given in the notes on the HTTPACTION command:
If you still haven’t solved the issue can you please share the part of your code that is responsible for the connection to the host? Also please share the url of the server where you are connecting to. In case you have solved please do share the reason /fix.
yes, the problem was i followed that connection which worked in calling and sending SMS, but didn’t allow me to use the internet until i disconnect the gnd which isn’t near to the uart pins.
https://i2.wp.com/randomnerdtutorials.com/wp-content/uploads/2017/08/GSM-FTDI-circuit-1.png?ssl=1
how much time we need for get AT response as 200 if network is good
within a second or two
hello sir i have new sim900A it nothing write on pc baud rate is 9600
what is the problem
try 115200 baud rate
hello i am using sim900 i am getting the information from the scanner but i do not know how to use it please help me.
what do you mean by scanner?
Hello Muhammad Shah, Nice Post, I am getting At response Code 603, how to fix the issue. please help. thank you. Dileep
Please check this comment
603 is DNS Error
@sgthoppa – you might want to check out this page about solving your 601 issue: http://stackoverflow.com/questions/15975051/error-httpaction0-601-0
Thank you Mr Muhammad for sharing your expertize, I’m just starting to take CScience course and this blog is goinf to help a lot to understand some practical things, as I am starting to play around with some arduinos and SIMs, server, clients and so on.
I am getting the AT response code (601). How to go about getting rid of this?
Thank you.
The above AT response code (601) for HTTP session start indicates that there is a network error. Then make sure that the PDP context is setup properly.
Thank you for your quick replies. But I am new to using gprs using gsm board. How to set up the PDP context and get the entire GET request successfully using the module.
Sir,
I am trying to send the data using gprs sim 800a,i am getting network error,before executing the AT+SAPBR=1,1 Signal strength will be good but as soon as AT+SAPBR=1,1 is executed led starts blinking continuously and returns response code 601.can you please help me how to resolve this issue? here is the AT commands used and the responses i got
601 is some custom implemented Error code.
Here is the list of standard HTTP Status codes
+HTTPACTION:0,601,0
The above AT response code (601) for HTTP session start indicates that there is a network error. Then make sure that the PDP context is setup properly.
source