AT+CSTT="live.vodafone.com"$0D$0A OK
AT+CIPSHUT$0D$0A SHUT OK
AT+CIPMUX=0$0D$0A OK
AT+CLPORT="TCP",80$0D$0A OK
AT+CIICR$0D$0A OK
AT+CIPSTART="TCP","http://ph.mydomain.in",80$0D$0A OK CONNECT OK
AT+CIPSEND$0D$0A
GET /phreading.aspx?value=092016040804550815 HTTP/1.1$0D$0A
Host: http://www.ph.mydomain.in$0D$0A$0D$0A
$1A
than i get following error.
Please help me to solve this problem. and tell me the right sequence to send data on server correctly.
Try to use AT+HTTPPARA command to send your get request. Its much easier than using the CIPSEND method.
Connect to GPRS
AT+CGATT?
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","live.vodafone.com"
AT+SAPBR=3,1,"USER","APN_USERNAME" // adapt it to yours
AT+SAPBR=3,1,"PWD","APN_PASSWORD" // adapt it to yours
AT+SAPBR=1,1
SEND DATA USING HTTP GET
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","www.ph.mydomain.in//phreading.aspx?value=092016040804550815"
AT+HTTPACTION=0 // sends HTTP GET
AT+HTTPTERM // terminate HTTP request
AT+SAPBR=0,1 // disconnect gprs if required
Hope this helps..
Related
I'm trying to get a gprs connection to a server by using a sim 800 module.
I'm getting 601 errors.
I have tried the debbuging that are described in this question: error +HTTPACTION:0,601,0
AT
OK
ATZ
OK
AT+CFUN=1
OK
AT+CPIN?
+CPIN: READY
OK
AT+SAPBR=3,1,"Contype","GPRS"
OK
AT+SAPBR=3,1,"APN","internet.t-d1.de"
OK
AT+SAPBR=3,1,"USER","t-mobile"
OK
AT+SAPBR=3,1,"PWD","tm"
OK
AT+SAPBR=1,1
OK
AT+SAPBR=2,1
+SAPBR: 1,1,"37.83.19.125"
OK
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","https://mrgames-server.de/vehicle_safe/get.php?command=test"
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,601,0
AT+HTTPREAD
OK
AT+HTTPTERM
Has anyone ever done this sucessfully?
I've learned that if you want to make a request to HTTPS websites, you need to use At+HTTPSSL=1. However, i'm trying to do the same, make a request to a https server and it's not working. I'm only getting 606/601/606 responses.
Also, remember, SIM800 only supports TSL1.0, as far as I know.
you should follow instructions that is written by SIMCOM itself.
https://cdn-shop.adafruit.com/datasheets/sim800_series_ip_application_note_v1.00.pdf
If you get network error 0,601,0, you can follow instructions under HTTP Get Post header. However, the only thing that you should do is putting AT+SAPBR=0,1 to end of the command sequence. Do your http configurations first, get http data from the url, and deact the process using AT+SAPBR=0,1. Moreover, in the application note you will notice that APN is configures as CMNET. You can try this, hopefully it is going to work.
I want to set the Real Time Clock on my STM32F4 board that I use with a SIM800 modem. I try to send HTTP GET or HEAD request (for example to "google.com") and use the timestamp in the response header to set my RTC.
I can send the request and get the response but I can't read the response's header.
The code is use and the response:
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","www.google.com"
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,302,256
AT+HTTPHEAD
ERROR
Why I got the ERROR at the end? I tried to send request to another URL, in this case I get HTTP OK(200) and can read data but still can't the header.
AT+HTTPHEAD doesn't work in sim800C. It works in: SIM800H,SIM800L,SIM800,SIM800G. Read "AT Command Manual" -
Only Part of Projects Support Following AT Commands.
+HTTPACTION: 0,302,256,
302 error is Found.
Check Mobile Balance or Internet Package in your sim.
It happens when you are out of Balance.
I have a Telit HE910 cellular modem communicating over UART to AVR. I am issuing the AT command for HTTP GET to a server. According to the modem datasheet, I should get three carrots (<<<) and then the data stream from the server. I get the three carrots but no data. The HTTP response code is 200 (ok) with a content length of 0. On the server side, I am logging the request so I can verify the GET request is hitting the server. So on both the server and the modem, I get OK's but no data. I can perform a GET request to the server from another web page and it works fine. Does anyone have any ideas of what could cause this?
PHP page is just echoing strings out on the request. For example
<php?
header('Content-type: text/plain');
echo 'Test';
?>
AVR / Modem code
sprintf(buf, "#HTTPCFG=0,\"%s\",80,0,,,0,120,1", host);
AT_ASSERT(AT_OK == AT_SendCommand(buf, response));
sprintf(buf, "#HTTPQRY=%d,%d,%s%c",
get_profile(),
0,
page,
CR);
AT_ASSERT(AT_OK == AT_SendCommand(buf, response));
sprintf(buf, "AT#HTTPRCV=0%c", CR);
UART0_TxString(buf);
c = UART0_RxChar();
response[0]=c;
i=0;
while((c=UART0_RxChar()) != CR)
{
response[i++]=c;
}
UART1_Flush();
UART1_Printf("received: %s\n", response);
Response in Terminal
received:
<<<
HTTP POST Complete
There should be data behind the <<< according to datasheet
Okay, it turns out that nothing was wrong with the C code on the AVR. I found a test server for HTTP GET request and tested the module successfully on a that site. So the underlying issue is with the PHP file in responding to the HTTP GET request.
I'm stumped with sending data to a remote server , I'm able to send a post request but not sure how to add data which is then received by the server.
I've went through the datasheet http://www.jarzebski.pl/datasheets/SIM900_https-121018-1.00.pdf
tried
# usual at+sapbr=1,1 set up
+HTTPINIT
+HTTPPARA = “CID”,1
+HTTPPARA="URL","IP-ADDRESS:PORT"
+httpdata=100,10000
# Where do I add the post data ?
+httpaction=1
which sends the http post request. But how do I add data - I've tried adding it to the url ?key=val but no joy - any help here will be appreciated
httpdata=100,10000 means that SIM800 should expect 100 bytes within 10 seconds.
This is how I accomplished this using the HTTP client:
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://url.com/endPoint"
AT+HTTPPARA="CONTENT","application/json"
AT+HTTPDATA=40,10000
At this point, the SIM800 should respond with "DOWNLOAD". Which means it's expecting your data. Send in your data; in my case:
{"location_id": 238, "fill_percent": 90}
Wait 10 seconds to send the rest of the commands. Then:
AT+HTTPACTION=1
AT+HTTPREAD
AT+HTTPTERM
That did it for me. Hope it helps.
This is where I got the information from: http://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands
In the backend, using Python Flask, this is the code I used
#app.route('/reportTrashLevel', methods=['POST'])
def report_trash_level():
data = request.get_json()
database.insert_trash_level(data)
return Response(status=200)
I managed to get it to do what I need, this code-snippet will likely help others
AT+CGATT=1 # enter GPRS configuration mode
AT+CIPMUX=0 # Disable multi IP connection mode. Single IP cnxn only
AT+CSTT="APN","USER","PASS"
AT+CIICR # bring up wireless connection with GPRS and CSD
AT+CIFSR # ip up - gprs working
AT+CIPSHUT # Exit GPRS configuration mode
# Now do a post request to remote server api in json format.
# Change IP_ADDR|DOMAIN for the IP or domain name of your server.
# Change 2000 to its port
AT+CIPSTART="TCP","IP_ADDR|DOMAIN","2000"
AT+CIPSEND=119 # Num of char in tcp/ip data, \r & \n count as 1 char
POST /post HTTP/1.1
Host: **.**.***.***
Content-Type: application/json
Content-Length:23
{"postkey":"postvalue"}
Hope this helps the next person stuck on it.
Using SIM 900 :
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","www.onewebsite.fr"
AT+HTTPDATA=lengthofpostdata, 10000
sending data
AT+HTTPACTION=1
AT_HTTPREAD=0, lengthofreceiveddata
Up to that point everything works OK
Then i send a new request :
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","www.onewebsite.fr"
AT+HTTPDATA=lengthofpostdata, 10000
sending data
AT+HTTPACTION=1
Then I received the message : +HTTPACTION=1,601,0
Any idea ?
601 is some custom implemented Error code, as an example
This is a "magic" status code that we use to signal that something wrong happened with the request that was so bad that we didn't even got a response back from the server. In this case the request timed out (more than 30 seconds to return any bytes).
source
Here is the list of standard HTTP Status codes
At times you would get this error if you are sending requests too often as well! try to increase the delay between the two requests!
. +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
I faced this problem and the solution is to open the bearer again before the second request.
Use
AT+SAPBR=1,1https://stackoverflow.com/questions
Some steps I have found to work:
Use the Adafruit FONA library if possible
Before every HTTP request check whether GPRS is enabled
If GPRS is enabled, check whether you have been assigned an IP Address
If 2 and 3 are true, proceed to make the HTTP request. If not, try to reconnect to GPRS until 2 and 3 are true