httpFirebase icon indicating copy to clipboard operation
httpFirebase copied to clipboard

how to send data to arduino from firebase to php

Open xiaomy12 opened this issue 6 years ago • 13 comments

need help here I already used your code examples but this time I want to send data to firebase then the data will be used by the arduino to be more specific I want to changed the arduino wifi by sending data to firebase

xiaomy12 avatar Jun 15 '19 06:06 xiaomy12

specifically the SSID and password of the wifi

xiaomy12 avatar Jun 15 '19 06:06 xiaomy12

I think you should probably base64 encode the wifi and password for security. Possibly create a function on the Arduino side that makes a secure call to a new script that retrieves the Wifi and Password, updates the Arduino and restarts it? Just a thought...

On Sat, Jun 15, 2019 at 1:15 AM xiaomy12 [email protected] wrote:

specifically the SSID and password of the wifi

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/robertcedwards/httpFirebase/issues/4?email_source=notifications&email_token=AABCD77UFQJXAKN3OPLDG2TP2SCH7A5CNFSM4HYOLOD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXYRL4A#issuecomment-502339056, or mute the thread https://github.com/notifications/unsubscribe-auth/AABCD77JH54ZU4THSAQDFKTP2SCH7ANCNFSM4HYOLODQ .

robertcedwards avatar Jun 22 '19 18:06 robertcedwards

yes sir thank you sir can I send my codes here? should I add a function on the php code? that receives data for Wifi SSID and Password

xiaomy12 avatar Jun 24 '19 03:06 xiaomy12

PHP code

`<?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 = 'xxxxx'; // --- 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);

?> `

xiaomy12 avatar Jun 24 '19 03:06 xiaomy12

sir I hope you can help me with this

I already searched so much articles but yet get none of it related to the topic of mine

xiaomy12 avatar Jun 26 '19 13:06 xiaomy12

sir good morning

by putting " echo " on the PHP code the data will be sent to arduino

the problem is the firebase how I can retrieve data from firebase using the PHP

xiaomy12 avatar Jul 02 '19 01:07 xiaomy12

Hello, ah I see. There should be some documentation and code examples for pulling from Firebase here maybe this would help: https://stackoverflow.com/questions/48924175/can-we-use-firebase-realtime-database-with-core-php The harder part, at the time, was communicating with the Arduino. -Rob

On Mon, Jul 1, 2019 at 8:39 PM xiaomy12 [email protected] wrote:

sir good morning

by putting " echo " on the PHP code the data will be sent to arduino

the problem is the firebase how I can retrieve data from firebase using the PHP

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/robertcedwards/httpFirebase/issues/4?email_source=notifications&email_token=AABCD765UYIG4XSE3VYLONDP5KWTHA5CNFSM4HYOLOD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY7ZP7Y#issuecomment-507484159, or mute the thread https://github.com/notifications/unsubscribe-auth/AABCD77MANIJKRTOGGDMG3TP5KWTHANCNFSM4HYOLODQ .

robertcedwards avatar Jul 03 '19 00:07 robertcedwards

hello sir the code or library and documentation used on that forum wasn't the same with the PHP code I used

I don't know how to use it too

xiaomy12 avatar Jul 03 '19 12:07 xiaomy12

I can't use your PHP code here? can you produce a code that is aligned on your code here ? to enable http or PHP to retrieve data from firebase thank you sir

xiaomy12 avatar Jul 06 '19 14:07 xiaomy12

sir

xiaomy12 avatar Jul 14 '19 06:07 xiaomy12

sir I still don't know how to solve this I hope you can help me

xiaomy12 avatar Jul 17 '19 04:07 xiaomy12

This code was written a while ago and Firebase has changed much of how it operates. I suggest reading up on php examples for Firebase from tutorials or youtube videos.

robertcedwards avatar Jul 17 '19 16:07 robertcedwards

I think I will get it now, first I need to work with the PHP

xiaomy12 avatar Nov 21 '19 05:11 xiaomy12