I am trying to send data to firebase but for some reason when I try to send the data from my Arduino using get method it will not work if I go through web browser this code works no problem. but when I run it through Arduino it does not work at all what is the best way to send data from the Arduino to firebase using a gprs module
<?php
// some php stuff
$mapId = $_GET['mapId']; //username
$bike = $_GET['bike'];
$lat = $_GET['lat'];
$lng = $_GET['lng'];
$ori = $_GET['ori'];
?>
<script src='https://cdn.firebase.com/js/client/2.3.1/firebase.js'></script>
<script type="text/javascript">
var mapId = '<?php echo $mapId ?>';
var bike = '<?php echo $bike ?>';
var lat = '<?php echo $lat ?>';
var lng = '<?php echo $lng ?>';
var ori = '<?php echo $ori ?>';
var ref = new Firebase('https://granted-7cdeb.firebaseio.com/maps/'+ mapId);
var usersRef = ref.child(bike);
function now() {
return Math.floor(Date.now() / 1000);
}
function saveData()
{
usersRef.set({
coords: {
latitude: lat,
longitude: lng
},
orientation: ori,
timestamp: now()
});
}
window.onload = saveData;
</script>
<?php
?>
Arduino code this code send the request to the php file that on my server
GPRS.println("AT+SAPBR=3,1,\"CONTYPE\",\"GPRS\"");//setting the SAPBR, the connection type is using gprs
delay(300);
GPRS.println("AT+SAPBR=3,1,\"APN\",\"WHOLESALE\"");//setting the APN, the second need you fill in your local apn server
delay(300);
GPRS.println("AT+SAPBR=1,1");//setting the SAPBR, for detail you can refer to the AT command mamual
delay(300);
GPRS.println("AT+HTTPINIT"); //init the HTTP request
delay(300);
GPRS.println("AT+HTTPPARA=\"URL\",\"http://grantedsecurity.com/arduino/test.php?GET VARIABLES REQUEST BLAH BLAH\"");// setting the httppara, the second parameter is the website you want to access
delay(300);
GPRS.println("AT+HTTPACTION=0");//submit the request
delay(300);//the delay is very important, the delay time is base on the return from the website, if the return datas are very large, the time required longer.
//while(!mySerial.available());