0

I'm using the Sim800L module and the NEO6M GPS Module in combination with an Arduino nano to create a simple tracking device. I get the data from the GPS and try to upload it to my site with some simple PHP scripts. I'm using this code down here:

//the function - which is responsible for sending data to the web server
void sendLocation(String lat, String lon){
 Sim800l.listen();
 //The line below sets the URL we want to connect to
 Sim800l.println("AT+HTTPPARA=\"URL\", \"http://" + ipAddress +  "/log_info.php?dev_id=13&lat=" + lat + "&lon=" + lon + "\"");
 waitUntilResponse("OK");
 //GO
 Sim800l.println("AT+HTTPACTION=0");
 waitUntilResponse("200");
 Serial.println("Location sent");
 gpsPort.listen();
}

Unfortunately, when I try to use this code, in my serial monitor I get this message:

AT+HTTPACTION=0
OK
+HTTPACTION: 0,302,171
error

I Looked it up in the datasheet for the Sim800L, and the number 302 means "Found". I'm expecting the number 200 for "OK". I have no idea what I did wrong, the data is not being send to the web server for some reason. I hope you can help. Thanks in advance!

EDIT: The datasheet with all the errors for the Sim800L https://www.elecrow.com/wiki/images/2/20/SIM800_Series_AT_Command_Manual_V1.09.pdf

  • 302 is HTTP code returned by the server. it is used for redirection. try to print the response with HTTPREAD. most common redirection is to https on the same server. does the server support unsecured access with http? – Juraj Jun 23 at 15:43
  • The server im using does niet support HTTPS. But how would i go about using this command? AT+HTTPREAD=URL or something else? – Berne Gerrits Jun 23 at 15:54
  • page 261 in the manual – Juraj Jun 23 at 16:52
  • Thanks, im trying it now. – Berne Gerrits Jun 23 at 16:57
  • I'm a bit of a noob with this stuff, I think I've got the syntax wrong but im not getting any response while trying this command – Berne Gerrits Jun 23 at 17:02
1

302 is HTTP code returned by the server. It is used for redirection. Print the response with AT+HTTPREAD to see where does it redirectd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.