How to make PHP code to receive data from firebase?

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
xiao23
New php-forum User
New php-forum User
Posts: 11
Joined: Tue Mar 12, 2019 7:21 am

Wed Jun 26, 2019 5:35 am

I am working on IoT stuff and I am using PHP as a gateway of connection between the firebase and arduino

but I got the difficulties on getting data from firebase and send it back to arduino

the PHP code/script I am using is just for sending data to firebase

I don't have ideas on receiving a data from firebase

any PHP experts?

thank you

xiao

Code: Select all

<?php

require 'firebaseLib.php';
$Trash = $_GET["trash"];

$Distance = $_GET["distance"];
$Temperature = $_GET["temp_f"];
$Humidity= $_GET["humidity"];

// --- This is your Firebase URL
$baseURI = 'https://thesis1-69.firebaseio.com';
// --- Use your token from Firebase here
$token = 'gg';
// --- Here is your parameter from the http GET



$devicestatus= array('Distance' => $Distance,'Temperature' => $Temperature,'Humidity' => $Humidity);

$firebasePath = '/thesis1-69/';




$full= array($Trash => $devicestatus);

/// --- Making calls
$fb = new Firebase($baseURI, $token);
$fb -> update($firebasePath, $full);


?>

User avatar
xiao23
New php-forum User
New php-forum User
Posts: 11
Joined: Tue Mar 12, 2019 7:21 am

Wed Jun 26, 2019 6:21 pm

any opinions about this process? should I add a code or change on it?
I only know how to send but not to receive a data from frebase

User avatar
xiao23
New php-forum User
New php-forum User
Posts: 11
Joined: Tue Mar 12, 2019 7:21 am

Wed Jul 10, 2019 5:19 pm

when I used "Echo" on the PHP it sends data to arduino

but still I don't know how to retrieve data on firebase using my code used

User avatar
xiao23
New php-forum User
New php-forum User
Posts: 11
Joined: Tue Mar 12, 2019 7:21 am

Sat Jul 13, 2019 10:59 pm

is there anyone can help me?
PHP expert?
IoT enthusiast??

hello guys!

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 845
Joined: Mon Feb 22, 2016 5:52 pm

Sun Jul 14, 2019 3:00 am

I would suggest that you look at help pages for firebase, if someone could help you from this forum, I'm sure they would have.

Good luck in your endeavours.

User avatar
xiao23
New php-forum User
New php-forum User
Posts: 11
Joined: Tue Mar 12, 2019 7:21 am

Tue Jul 16, 2019 8:56 pm

oh thanks sir

I hope I can find it
I also hope I can get any help here soon :)

Post Reply