forked from ktamas77/firebase-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirebaseTest.php
More file actions
34 lines (24 loc) · 785 Bytes
/
Copy pathfirebaseTest.php
File metadata and controls
34 lines (24 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require_once 'firebaseLibAuth.php';
// --- set up your own database here
$url = 'https://yourdatabase.firebaseio.com/';
$token = 'YOUR TOKEN HERE';
$fb = new fireBase($url,$token);
$todos = array(
'name' => 'Pick the milk',
'priority' => 1
);
$todoPath = '/sample/todo';
printf("Database: %s\n", $url);
printf("Sending data to %s\n", $todoPath);
$response = $fb->set($todoPath, $todos);
printf("Result: %s\n", $response);
printf("Reading data from %s\n", $todoPath);
$response = $fb->get($todoPath);
printf("Result: %s\n", $response);
printf("Deleting data %s\n", $todoPath);
$response = $fb->delete($todoPath);
printf("Result: %s\n", $response);
printf("Reading data from %s\n", $todoPath);
$response = $fb->get($todoPath);
printf("Result: %s\n", $response);