0

I'm trying to send data from Arduino to my server using get method. Using sim800L & Arduino Nano through AT Commands.

GSM_serial.print("+++");
updateSerial();
delay(1000);
GSM_serial.print("AT\r\n");
updateSerial();
delay(1000);
GSM_serial.print("ATE1\r\n"); 
updateSerial();
delay(1000);
GSM_serial.print("AT+CGATT=1\r\n");
updateSerial();
delay(1000);
GSM_serial.print("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"\r\n");
updateSerial();
delay(1000);
GSM_serial.print("AT+SAPBR=3,1,\"APN\",\"");
updateSerial();
GSM_serial.print(AccessPointName);
updateSerial();
GSM_serial.print("\"\r\n");
updateSerial();
delay(1000);
GSM_serial.print("AT+SAPBR=1,1\r\n");
updateSerial();
delay(3000);
GSM_serial.print("AT+HTTPINIT\r\n");
updateSerial();
delay(1000);
GSM_serial.print("AT+HTTPPARA=\"CID\",1\r\n");
updateSerial();
delay(2000);
GSM_serial.print("AT+HTTPPARA=\"URL\",\"");
GSM_serial.print(HTTPserver);// defined above as #define HTTPserver 
"http://--------.me"
GSM_serial.print(HTTPurl);//defined above as #define HTTPurl "/d.php?"
GSM_serial.print(message);// message is i=1&f=2
// total url is http://---------.me/d.php?i=1&f=2
GSM_serial.print("\"\r\n");
updateSerial();
delay(2000);
GSM_serial.print("AT+HTTPACTION=0\r\n");
updateSerial();
delay(6000);
GSM_serial.print("AT+HTTPTERM\r\n");
updateSerial();

Result in serial Monitor:

AT
OK
ATE1
OK
AT+CGATT=1
OK
AT+SAPBR=3,1,"CONTYPE","GPRS"
OK
AT+SAPBR=3,1,"APN","touch"
OK
AT+SAPBR=1,1
OK
Connected
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","https://system.fabricaid.me/d.php?i=1&f=2"
AT+HTTPACTION=0
OK
+HTTPACTION: 0,603,0
AT+HTTPTERM
OK
AT+S

Expected HTTP Action should be 200 instead of 603

+HTTPACTION: 0,603,0
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
Hussam
  • 1
  • 3
    There's no standard `603` HTTP return codes. Perhaps you should take a look at what happens on the server? Or read the documentation of the modem if it's the modem that replies with the 603 error? – Some programmer dude Sep 09 '19 at 14:08
  • 1
    You should [never, never, never ever use `delay` like that](https://stackoverflow.com/a/46064206/23118). TL;DR: You must **read and parse** everything the modem sends back to you. **Nothing else will work reliably**. – hlovdal Sep 10 '19 at 21:32
  • @Hussam Did you have success when you changed to **reading and parsing** responses from the modem? Could you update the code in the question? – hlovdal Sep 21 '19 at 22:11
  • In the SIM800 documentation, the 603 code corresponds to DNS Error. Did you solve the problem? – omfaer Mar 23 '20 at 13:19

1 Answers1

0

You need to escape both ? and &. The whole URL should be

GSM_serial.println("AT+HTTPPARA=\"URL\",\"https://system.fabricaid.me/d.php\?i=1\&f=2\"");