首页 文章

使用Laravel 5.2连接到Firebase - 'Error creating resource'

提问于
浏览
3

我有一个SSL主机和域,我可以从https://example.net访问,Chrome显示绿色SSL锁
enter image description here
;我得到了Laravel的欢迎页面 .

然后,我尝试连接到Firebase . 在Github上更方便的方式似乎是firebase-php . 我使用composer安装它并进行设置 .

但是我开始收到错误:

RequestException.php第51行中的RequestException:创建资源时出错:[message] fopen(https://example.firebaseio.com/users.json?auth=QwerTy):无法打开流:连接超时[file] / var /www/laravel/vendor/guzzlehttp/ringphp/src/Client/StreamHandler.php [line] 406 [message]未定义变量:http_response_header [file] / var / www / laravel / vendor / guzzlehttp / ringphp / src / Client / StreamHandler .php [line] 407

我做错了什么或错过了什么?

此外,如果您有任何使用PHP连接到Firebase的解决方案,请分享

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 回答

  • 0

    我知道这是一个老问题,但我们刚刚在我们的服务器上遇到过这个问题(在Homestead工作正常) . 原来是curl没有安装在服务器上 - 检查一下 .

相关问题