forked from jackrtd/LINE-BOT-PHP-Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_connect_firebase.php
38 lines (29 loc) · 1.15 KB
/
test_connect_firebase.php
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
35
36
37
38
<?php
require __DIR__."/vendor/autoload.php";
$firebase = Firebase::fromServiceAccount(__DIR__.'/puri-contact-firebase-adminsdk-l04g2-fa656ae233.json');
$database = $firebase->getDatabase();
$reference = $database->getReference('object/Line_contact');
//$reference = $database->getReference('line');
//$value = $database->getReference('line')->getChildKeys();
//$value = $reference->getChildKeys();
$data = $reference->getValue();
$filter = 'Ub1c272947e6de856751d7142334b88ca1';
foreach($data as $value){
if($filter==$value['line_id']){$duplicate = true;}
}
if($duplicate){
echo "Have already";
}
//$snapshot = $reference->orderByChild("line_id")->equalTo('Ub1c272947e6de86751d7142334b88ca1')->getSnapshot();
//$snapshot = $reference->orderByChild("line_id")->equalTo($filter)->getSnapshot();
//$value = $snapshot->getValue();
//$value = $reference->orderByChild("line_id")->equalTo("Ub1c272947e6de86751d7142334b88ca1")->getValue();
//$value = $reference->orderByChild("line_id")->equalTo(123)->getSnapshot();
//echo json_encode($value);
/*
$reference->push([
'title' => 'Post title',
'body' => 'This should probably be longer.'
]);
*/
?>