Skip to content

Instantly share code, notes, and snippets.

@JarvusChen
Last active May 3, 2018 13:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JarvusChen/66d3d55c656e053013836d56af8a23cc to your computer and use it in GitHub Desktop.
Save JarvusChen/66d3d55c656e053013836d56af8a23cc to your computer and use it in GitHub Desktop.
<?php
require_once 'firebaseLib.php';
// --- This is your Firebase URL
$url = 'https://jarvus.firebaseio.com/';
// --- Use your token from Firebase here
$token = 'h1aX4FcGVsU5Ix81dG6qgmUQ7eeBRuati7Fzs8yt';
// --- Here is your parameter from the http GET
// --- you can add whatever you want
$data1 = $_GET['data1'];
$data2 = $_GET['data2'];
$data3 = $_GET['data3'];
$data4 = $_GET['data4'];
// --- Set up your Firebase url structure here
/// --- Making calls
$fb = new fireBase($url, $token);
// --- use uploading time as the path
date_default_timezone_set ('Asia/Taipei');
$now = (string)date("YmdHis");
// echo $now;
// you can use set or push
$response = $fb->set("/dataA/" . $now . "/data1/", $data1);
$response = $fb->push("/dataA/" . $now . "/data2/", $data2);
$response = $fb->set("/dataB/" . $now . "/data3/", $data3);
$response = $fb->set("/data4/", $data4);
sleep(2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment