user77917: I have an Arduino UNO and SIM808 and I'm trying to send my GPS data to the Firebase. I have successfully created a website which I can post data from the website to the Firebase. However I'm trying to send my data from Arduino to the website which failed constantly. I have no idea what is the error.
These are my codes:
  /*
    ### Get GPS data
    1. This example is used to test SIM808 GPS/GPRS/GSM Shield's reading GPS data.
    2. Open the SIM808_GetGPS example or copy these code to your project
    3. Download and dial the function switch to Arduino
    4. open serial helper
    4. Place it outside, waiting for a few minutes and then it will send GPS data to serial
  
    create on 2016/09/23, version: 1.0
    by jason
  
  */
  #include <DFRobot_sim808.h>
  #include <SoftwareSerial.h>
  
  #define PIN_TX    10
  #define PIN_RX    11
  SoftwareSerial mySerial(PIN_TX, PIN_RX);
  DFRobot_SIM808 sim808(&mySerial);//Connect RX,TX,PWR,
  
  #define APN "diginet"
  #define USER ""
  #define PASS ""
  unsigned long previousMillis = 0;
  long interval = 60000;
  
  String the_year, the_month, the_day, the_hour, the_minute, the_second, the_time;
  String latitude, longitude;
  
  //DFRobot_SIM808 sim808(&Serial);
  
  void setup() {
    mySerial.begin(9600);
    Serial.begin(9600);
  
    //******** Initialize sim808 module *************
    while (!sim808.init()) {
      delay(1000);
      Serial.print("Sim808 init error\r\n");
    }
  
    //************* Turn on the GPS power************
    if ( sim808.attachGPS())
      Serial.println("Open the GPS power success");
    else
      Serial.println("Open the GPS power failure");
  
  }
  
  void loop() {
    //************** Get GPS data *******************
    getGPS();
  
    unsigned long currentMillis = millis();
    if (currentMillis - previousMillis > interval) {
      previousMillis = currentMillis;
      sendtoFirebase();
    }
  
  }
  
  void getGPS() {

    if (sim808.getGPS()) {
      delay(500);
      the_year = sim808.GPSdata.year;
      the_month = sim808.GPSdata.month;
      the_day = sim808.GPSdata.day;
      the_hour = sim808.GPSdata.hour;
      the_minute = sim808.GPSdata.minute;
      the_second = sim808.GPSdata.second;
      the_time = the_year + " / " + the_month + " / " + the_day + " " + the_hour + ": " + the_minute + ": " + the_second;
      Serial.print(the_time);
      //Serial.print(sim808.GPSdata.year);
      //types(sim808.GPSdata);
      
  
      latitude = String(sim808.GPSdata.lat, 6);
      longitude = String(sim808.GPSdata.lon, 6);
      Serial.println(latitude);
      Serial.println("longitude : ");
  
      Serial.println(longitude);
  
      sim808.latitudeConverToDMS();
      sim808.LongitudeConverToDMS();
      //Serial.print("latitude : ");
      //        Serial.print(sim808.latDMS.degrees);
      //        Serial.print("\^");
      //        Serial.print(sim808.latDMS.minutes);
      //        Serial.print("\'");
      //        Serial.print(sim808.latDMS.seconeds,6);
      //        Serial.println("\"");
      //    Serial.print("longitude :");
      //    Serial.print("longitude :");
      //    Serial.print(sim808.longDMS.degrees);
      //    Serial.print("\^");
      //    Serial.print(sim808.longDMS.minutes);
      //    Serial.print("\'");
      //    Serial.print(sim808.longDMS.seconeds, 6);
      //    Serial.println("\"");
  
      //    Serial.print("speed_kph :");
      //    Serial.println(sim808.GPSdata.speed_kph);
      //    Serial.print("heading :");
      //    Serial.println(sim808.GPSdata.heading);
  
      //************* Turn off the GPS power ************
      //sim808.detachGPS();
    }
  }
  
  void sendtoFirebase() {
  
    boolean newData = false;
    for (unsigned long start = millis(); millis() - start < 2000;) {
      while (sim808.getGPS()) {
        newData = true;
      }
    }
  
    if (newData) {
      newData = false;
  
      String deviceId = "ABC1235";
  
      Serial.print("Device ID:");
      Serial.println(deviceId);
  
      Serial.print("Time:");
      Serial.println(the_time);
      Serial.print("latitude:");
      Serial.println(latitude);
      Serial.print("longitude:");
      Serial.println(longitude);
  
      String temp;
  
      //build the URL to the proxy
      String url = "http://myfypproject.epizy.com/firebase.php?arduino_data=25.00";
      //  url += "&deviceid=";
      //  url += String(deviceid);
      //  url += "&lat=";
      //  url += String(latitude);
      //  url += "&lon=";
      //  url += String(longitude);
  
      Serial.println(url);
      sendATcommand("AT+CFUN=1", "OK", 2000);
      //AT+CGATT = 1 Connect modem is attached to GPRS to a network. AT+CGATT = 0, modem is not attached to GPRS to a network
      sendATcommand("AT+CGATT=1", "OK", 2000);
      //Connection type: GPRS - bearer profile 1
      sendATcommand("AT+SAPBR=3,1,\"Contype\",\"GPRS\"", "OK", 2000);
      //sets the APN settings for your network provider.
      sendATcommand("AT+SAPBR=3,1,\"APN\",\"diginet\"", "OK", 2000);
      //enable the GPRS - enable bearer 1
      sendATcommand("AT+SAPBR=1,1", "OK", 2000);
      //Init HTTP service
      sendATcommand("AT+HTTPINIT", "OK", 2000);
      sendATcommand("AT+HTTPPARA=\"CID\",1", "OK", 1000);
      //Set the HTTP URL sim800.print("AT+HTTPPARA="URL","http://ahmadssd.000webhostapp.com/gpsdata.php?lat=222&lng=222"\r");
      //sendATcommand("AT+HTTPPARA=\"URL\",\"http://myfypproject.epizy.com/firebase.php?arduino_data=25.00\"", "OK", 1000);
      mySerial.print("AT+HTTPPARA=\"URL\",\"");
      mySerial.print(url);
      sendATcommand("\"", "OK", 1000);
      //Set up the HTTP action
      sendATcommand("AT+HTTPACTION=0", "0,200", 1000);
      //Terminate the HTTP service
      sendATcommand("AT+HTTPTERM", "OK", 1000);
      //shuts down the GPRS connection. This returns "SHUT OK".
      //sendATcommand("AT+CIPSHUT", "SHUT OK", 1000);
  
    }
  
    return 1;
  }
  
  int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout) {
    uint8_t x = 0, answer = 0;
    char response[100];
    unsigned long previous;
  
    //Initialize the string
    memset(response, '\0', 100);
    delay(100);
  
    //Clean the input buffer
    while (mySerial.available() > 0) mySerial.read();
  
    if (ATcommand[0] != '\0') {
      //Send the AT command
      mySerial.println(ATcommand);
    }
  
    x = 0;
    previous = millis();
  
    do {
      //if there are data in the UART input buffer, reads it and checks for the asnwer
      if (mySerial.available() != 0) {
        response[x] = mySerial.read();
        //Serial.print(response[x]);
        x++;
        // check if the desired answer (OK) is in the response of the module
        if (strstr(response, expected_answer) != NULL) {
          answer = 1;
        }
      }
    } while ((answer == 0) && ((millis() - previous) < timeout));
  
    Serial.println(response);
    return answer;
  
  }

I keep get the error of 603.
AT+HTTPACTION=0
OK
+HTTPACTION: 0, 603, 0

Below are my PHP, website to firebase codes:
    <?php
require_once 'firebaseLib.php';
// --- This is your Firebase URL
$url = 'https://projectname-default-rtdb.asia-southeast1.firebasedatabase.app/';
// --- Use your token from Firebase here
$token = 'XXXXXXXXXXJYszyqIJxr3UuGl1Zr6qHG03K';
// --- Here is your parameter from the http GET
$arduino_data = $_GET['arduino_data'];
// --- Set up your Firebase url structure here
$firebasePath = '/GPSdata';

/// --- Making calls
$fb = new fireBase($url, $token);
$response = $fb->set($firebasePath, $arduino_data);
echo $url;
sleep(2);

UPDATE:
I can get code 200, but there isn't any result in my firebase or my website.

user77917: It is just the server problem. I just changed a website and it works.

77917: <p>I have an Arduino UNO and SIM808 and I'm trying to send my GPS data to the Firebase. I have successfully created a website which I can post data from the website to the Firebase. However I'm trying to send my data from Arduino to the website which failed constantly. I have no idea what is the error.</p>
<p>These are my codes:</p>
<pre><code>  /*
    ### Get GPS data
    1. This example is used to test SIM808 GPS/GPRS/GSM Shield's reading GPS data.
    2. Open the SIM808_GetGPS example or copy these code to your project
    3. Download and dial the function switch to Arduino
    4. open serial helper
    4. Place it outside, waiting for a few minutes and then it will send GPS data to serial
  
    create on 2016/09/23, version: 1.0
    by jason
  
  */
  #include &lt;DFRobot_sim808.h&gt;
  #include &lt;SoftwareSerial.h&gt;
  
  #define PIN_TX    10
  #define PIN_RX    11
  SoftwareSerial mySerial(PIN_TX, PIN_RX);
  DFRobot_SIM808 sim808(&amp;mySerial);//Connect RX,TX,PWR,
  
  #define APN &quot;diginet&quot;
  #define USER &quot;&quot;
  #define PASS &quot;&quot;
  unsigned long previousMillis = 0;
  long interval = 60000;
  
  String the_year, the_month, the_day, the_hour, the_minute, the_second, the_time;
  String latitude, longitude;
  
  //DFRobot_SIM808 sim808(&amp;Serial);
  
  void setup() {
    mySerial.begin(9600);
    Serial.begin(9600);
  
    //******** Initialize sim808 module *************
    while (!sim808.init()) {
      delay(1000);
      Serial.print(&quot;Sim808 init error\r\n&quot;);
    }
  
    //************* Turn on the GPS power************
    if ( sim808.attachGPS())
      Serial.println(&quot;Open the GPS power success&quot;);
    else
      Serial.println(&quot;Open the GPS power failure&quot;);
  
  }
  
  void loop() {
    //************** Get GPS data *******************
    getGPS();
  
    unsigned long currentMillis = millis();
    if (currentMillis - previousMillis &gt; interval) {
      previousMillis = currentMillis;
      sendtoFirebase();
    }
  
  }
  
  void getGPS() {

    if (sim808.getGPS()) {
      delay(500);
      the_year = sim808.GPSdata.year;
      the_month = sim808.GPSdata.month;
      the_day = sim808.GPSdata.day;
      the_hour = sim808.GPSdata.hour;
      the_minute = sim808.GPSdata.minute;
      the_second = sim808.GPSdata.second;
      the_time = the_year + &quot; / &quot; + the_month + &quot; / &quot; + the_day + &quot; &quot; + the_hour + &quot;: &quot; + the_minute + &quot;: &quot; + the_second;
      Serial.print(the_time);
      //Serial.print(sim808.GPSdata.year);
      //types(sim808.GPSdata);
      
  
      latitude = String(sim808.GPSdata.lat, 6);
      longitude = String(sim808.GPSdata.lon, 6);
      Serial.println(latitude);
      Serial.println(&quot;longitude : &quot;);
  
      Serial.println(longitude);
  
      sim808.latitudeConverToDMS();
      sim808.LongitudeConverToDMS();
      //Serial.print(&quot;latitude : &quot;);
      //        Serial.print(sim808.latDMS.degrees);
      //        Serial.print(&quot;\^&quot;);
      //        Serial.print(sim808.latDMS.minutes);
      //        Serial.print(&quot;\'&quot;);
      //        Serial.print(sim808.latDMS.seconeds,6);
      //        Serial.println(&quot;\&quot;&quot;);
      //    Serial.print(&quot;longitude :&quot;);
      //    Serial.print(&quot;longitude :&quot;);
      //    Serial.print(sim808.longDMS.degrees);
      //    Serial.print(&quot;\^&quot;);
      //    Serial.print(sim808.longDMS.minutes);
      //    Serial.print(&quot;\'&quot;);
      //    Serial.print(sim808.longDMS.seconeds, 6);
      //    Serial.println(&quot;\&quot;&quot;);
  
      //    Serial.print(&quot;speed_kph :&quot;);
      //    Serial.println(sim808.GPSdata.speed_kph);
      //    Serial.print(&quot;heading :&quot;);
      //    Serial.println(sim808.GPSdata.heading);
  
      //************* Turn off the GPS power ************
      //sim808.detachGPS();
    }
  }
  
  void sendtoFirebase() {
  
    boolean newData = false;
    for (unsigned long start = millis(); millis() - start &lt; 2000;) {
      while (sim808.getGPS()) {
        newData = true;
      }
    }
  
    if (newData) {
      newData = false;
  
      String deviceId = &quot;ABC1235&quot;;
  
      Serial.print(&quot;Device ID:&quot;);
      Serial.println(deviceId);
  
      Serial.print(&quot;Time:&quot;);
      Serial.println(the_time);
      Serial.print(&quot;latitude:&quot;);
      Serial.println(latitude);
      Serial.print(&quot;longitude:&quot;);
      Serial.println(longitude);
  
      String temp;
  
      //build the URL to the proxy
      String url = &quot;http://myfypproject.epizy.com/firebase.php?arduino_data=25.00&quot;;
      //  url += &quot;&amp;deviceid=&quot;;
      //  url += String(deviceid);
      //  url += &quot;&amp;lat=&quot;;
      //  url += String(latitude);
      //  url += &quot;&amp;lon=&quot;;
      //  url += String(longitude);
  
      Serial.println(url);
      sendATcommand(&quot;AT+CFUN=1&quot;, &quot;OK&quot;, 2000);
      //AT+CGATT = 1 Connect modem is attached to GPRS to a network. AT+CGATT = 0, modem is not attached to GPRS to a network
      sendATcommand(&quot;AT+CGATT=1&quot;, &quot;OK&quot;, 2000);
      //Connection type: GPRS - bearer profile 1
      sendATcommand(&quot;AT+SAPBR=3,1,\&quot;Contype\&quot;,\&quot;GPRS\&quot;&quot;, &quot;OK&quot;, 2000);
      //sets the APN settings for your network provider.
      sendATcommand(&quot;AT+SAPBR=3,1,\&quot;APN\&quot;,\&quot;diginet\&quot;&quot;, &quot;OK&quot;, 2000);
      //enable the GPRS - enable bearer 1
      sendATcommand(&quot;AT+SAPBR=1,1&quot;, &quot;OK&quot;, 2000);
      //Init HTTP service
      sendATcommand(&quot;AT+HTTPINIT&quot;, &quot;OK&quot;, 2000);
      sendATcommand(&quot;AT+HTTPPARA=\&quot;CID\&quot;,1&quot;, &quot;OK&quot;, 1000);
      //Set the HTTP URL sim800.print(&quot;AT+HTTPPARA=&quot;URL&quot;,&quot;http://ahmadssd.000webhostapp.com/gpsdata.php?lat=222&amp;lng=222&quot;\r&quot;);
      //sendATcommand(&quot;AT+HTTPPARA=\&quot;URL\&quot;,\&quot;http://myfypproject.epizy.com/firebase.php?arduino_data=25.00\&quot;&quot;, &quot;OK&quot;, 1000);
      mySerial.print(&quot;AT+HTTPPARA=\&quot;URL\&quot;,\&quot;&quot;);
      mySerial.print(url);
      sendATcommand(&quot;\&quot;&quot;, &quot;OK&quot;, 1000);
      //Set up the HTTP action
      sendATcommand(&quot;AT+HTTPACTION=0&quot;, &quot;0,200&quot;, 1000);
      //Terminate the HTTP service
      sendATcommand(&quot;AT+HTTPTERM&quot;, &quot;OK&quot;, 1000);
      //shuts down the GPRS connection. This returns &quot;SHUT OK&quot;.
      //sendATcommand(&quot;AT+CIPSHUT&quot;, &quot;SHUT OK&quot;, 1000);
  
    }
  
    return 1;
  }
  
  int8_t sendATcommand(char* ATcommand, char* expected_answer, unsigned int timeout) {
    uint8_t x = 0, answer = 0;
    char response[100];
    unsigned long previous;
  
    //Initialize the string
    memset(response, '\0', 100);
    delay(100);
  
    //Clean the input buffer
    while (mySerial.available() &gt; 0) mySerial.read();
  
    if (ATcommand[0] != '\0') {
      //Send the AT command
      mySerial.println(ATcommand);
    }
  
    x = 0;
    previous = millis();
  
    do {
      //if there are data in the UART input buffer, reads it and checks for the asnwer
      if (mySerial.available() != 0) {
        response[x] = mySerial.read();
        //Serial.print(response[x]);
        x++;
        // check if the desired answer (OK) is in the response of the module
        if (strstr(response, expected_answer) != NULL) {
          answer = 1;
        }
      }
    } while ((answer == 0) &amp;&amp; ((millis() - previous) &lt; timeout));
  
    Serial.println(response);
    return answer;
  
  }
</code></pre>
<p>I keep get the error of 603.</p>
<pre><code>AT+HTTPACTION=0
OK
+HTTPACTION: 0, 603, 0
</code></pre>
<p>Below are my PHP, website to firebase codes:</p>
<pre><code>    &lt;?php
require_once 'firebaseLib.php';
// --- This is your Firebase URL
$url = 'https://projectname-default-rtdb.asia-southeast1.firebasedatabase.app/';
// --- Use your token from Firebase here
$token = 'XXXXXXXXXXJYszyqIJxr3UuGl1Zr6qHG03K';
// --- Here is your parameter from the http GET
$arduino_data = $_GET['arduino_data'];
// --- Set up your Firebase url structure here
$firebasePath = '/GPSdata';

/// --- Making calls
$fb = new fireBase($url, $token);
$response = $fb-&gt;set($firebasePath, $arduino_data);
echo $url;
sleep(2);
</code></pre>
<p><strong>UPDATE:</strong></p>
<p>I can get code 200, but there isn't any result in my firebase or my website.</p>
 77917: <p>It is just the server problem. I just changed a website and it works.</p>
