i am trying to implement firebase with php, here is a link that I found:
https://github.com/ktamas77/firebase-php
and this is an example.
const DEFAULT_URL = 'https://kidsplace.firebaseio.com/';
const DEFAULT_TOKEN = 'MqL0c8tKCtheLSYcygYNtGhU8Z2hULOFs9OKPdEp';
const DEFAULT_PATH = '/firebase/example';
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
// --- storing an array ---
$test = array(
"foo" => "bar",
"i_love" => "lamp",
"id" => 42
);
$dateTime = new DateTime();
$firebase->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);
// --- storing a string ---
$firebase->set(DEFAULT_PATH . '/name/contact001', "John Doe");
// --- reading the stored string ---
$name = $firebase->get(DEFAULT_PATH . '/name/contact001');
And here is my version of the same code:
<?php
include 'firebaseLib.php';
const DEFAULT_URL = "https://third-try-dae0a.firebaseio.com";
const DEFAULT_TOKEN = 'AIzaSyDeGfW4hnT3a6AXDevJMhb4Pi1eMWQ7yvc';
const DEFAULT_PATH = '/third-try-dae0a';
$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);
// --- storing an array ---
$test = array(
"foo" => "bar",
"i_love" => "lamp",
"id" => 42
);
$dateTime = new DateTime();
$firebase->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);
// --- storing a string ---
$firebase->set(DEFAULT_PATH . '/name/contact001', "John Doe");
// --- reading the stored string ---
$name = $firebase->get(DEFAULT_PATH . '/name/contact001');
echo "done";
?>
my code doesn't work...
I just want a quick explanation of where I find the DEFAULT_TOKEN
and what about the DEFAULT_PATH ??