Usage Example for HTTP-GET Request
Last revision 2025/12/31
This article guides you through the process of executing HTTP-GET requests using the SIM7070G module and Arduino, covering necessary hardware, software preparation, and detailed operational steps. It provides insights into setting server URLs, managing HTTP headers, and efficiently retrieving data from servers.
Hardware Preparation
- TEL0182 SIM7070G Global NB-IoT Communication Module x1
- Windows11 PC x1
- NB SIM card x1
- NB_RF antenna x1
- GPS antenna x1
- FIT0668 Type-C&Micro 2-in-1 USB Cable x1
Software Preparation
- Download and install the driver: Click to download driver
Operation Steps
AT+CNACT=0,1
//Activate wireless connection, the first parameter '0' represents PDP Index, the second parameter '1' represents activation.
AT+CNACT?
//Get local IP address
AT+SHCONF="URL","http://www.baidu.com"
//Set server URL
AT+SHCONF="BODYLEN",1024
//Set HTTP body length, for the range of maximum body length
AT+SHCONF="HEADERLEN",350
//Set HTTP header length, for the range of maximum header length
AT+SHCONN
//Establish HTTP connection
AT+SHSTATE?
//Get HTTP status
//"+SHSTATE: 1": Connected
//"+SHSTATE: 0": Disconnected
AT+SHCHEAD
//Clear HTTP header, because the HTTP header is appended
AT+SHAHEAD="User-Agent","Mozilla/5.0"
//Add header content
AT+SHAHEAD="Cache-control","no-cache"
//Add header content
AT+SHAHEAD="Connection","keep-alive"
//Add header content
AT+SHAHEAD="Accept","*/*"
//Add header content
AT+SHREQ="/search?q=SIM7070G", 1
//Set request type to GET
//The response will depend on the actual size of the data returned by the server
//For example, the size of the data returned here is 247
AT+SHREAD=0,247
//Read data length is 247
//Data content follows "+SHREAD: 247"
AT+SHDISC
//Disconnect HTTP connection
AT+CNACT=0,0
//Close wireless connection, the first parameter '0' represents PDP Index, the second parameter '0' represents disconnect.
The default time to keep a request is 60 seconds, you can also choose the setting range of 30-1800
Was this article helpful?
