Connecting to Firebase with Laravel 5.2 - 'Error creating resource'

Viewed 672

I have an SSL host & domain, which I can access from https://example.net and Chrome shows the green SSL lock enter image description here; and I get Laravel's welcome page.

Then, I tried to connect to Firebase. The more convenient way seemed like firebase-php on Github. I installed it using composer and set it up.

However I started getting error:

RequestException in RequestException.php line 51:

Error creating resource: [message] fopen(https://example.firebaseio.com/users.json?auth=QwerTy): failed to open stream: Connection timed out [file] /var/www/laravel/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php [line] 406 [message] Undefined variable: http_response_header [file] /var/www/laravel/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php [line] 407

What am I doing wrong or missing?

Also if you have any solutions for connecting to Firebase with PHP, please share

use Firebase\Firebase;

class MyController extends Controller
{
   public function sendToken() {

       $fb = Firebase::initialize($_ENV['FIREBASE_URL'], $_ENV['FIREBASE_SECRET']);

       $nodeGetContent = $fb->get('/users');
       dd($nodeGetContent);
   }
}
1 Answers
Related