Send data SIM800L to MySQL

It’s been days we’ve been working on this Arduino project. I wonder if someone can help me send data to MySQL? my Code doesn’t seem to be working :confused:

we’re using
SIM800L
arduino Uno

#include <SoftwareSerial.h>
SoftwareSerial gprsSerial(7, 8);

void setup()
{
  gprsSerial.begin(19200);
  Serial.begin(19200);

  Serial.println("Config SIM800L...");
  delay(2000);
  Serial.println("Done!...");
  gprsSerial.flush();
  Serial.flush();

  // attach or detach from GPRS service 
  gprsSerial.println("AT+CGATT?");
  delay(100);
  toSerial();


  // bearer settings
  gprsSerial.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");
  delay(2000);
  toSerial();

  // bearer settings
  gprsSerial.println("AT+SAPBR=3,1,\"APN\",\"http.globe.com.ph\"");
  delay(2000);
  toSerial();

  // bearer settings
  gprsSerial.println("AT+SAPBR=1,1");
  delay(2000);
  toSerial();
}


void loop()
{
   // initialize http service
   gprsSerial.println("AT+HTTPINIT");
   delay(2000); 
   toSerial();

   // set http param value
   gprsSerial.println("AT+HTTPPARA=\"URL\",\"http://mywebsite.com/gps.php?user_id=0027&lon=14.123456&lat=127.1234567\""); 
   delay(2000);
   toSerial();

   // set http action type 0 = GET, 1 = POST, 2 = HEAD
   gprsSerial.println("AT+HTTPACTION=0");
   delay(6000);
   toSerial();

   // read server response
   gprsSerial.println("AT+HTTPREAD"); 
   delay(1000);
   toSerial();

   gprsSerial.println("");
   gprsSerial.println("AT+HTTPTERM");
   toSerial();
   delay(300);

   gprsSerial.println("");
   Serial.println("Sent?");
   delay(10000);
}

void toSerial()
{
  while(gprsSerial.available()!=0)
  {
    Serial.write(gprsSerial.read());
  }
}

Thanks :slight_smile:

my Code doesn’t seem to be working

Nonsense. It’s doing exactly what it is supposed to do. Now, that may not be what you want it to do, but that’s a completely different lament.

The code does something. You expect it to do something. You need to tell us what both of those things are.

You need also to look at the web server logs on the server, and see what it did with your requests.

We want to send Data(GPS Longitude & Latitude) to MySQL and what we're trying here is through opening the webpage with "http://website.com/gps.php?data1=123&data2=1234&data3=1234" if possible

neil_john0027:
We want to send Data(GPS Longitude & Latitude) to MySQL and what we're trying here is through opening the webpage with "http://website.com/gps.php?data1=123&data2=1234&data3=1234" if possible

So? What parts of what you want to do is the code actually doing? What parts is it not doing?