无法连接到testing-3be52.firebaseio.com端口443:连接被拒绝 [英] Failed to connect to testing-3be52.firebaseio.com port 443: Connection refused

查看:76
本文介绍了无法连接到testing-3be52.firebaseio.com端口443:连接被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用cURL在PHP中读取firebase的数据.

I am trying to read firebase's data in PHP using cURL.

$curl = curl_init();
$url = "https://testing-3be52.firebaseio.com/test-Details.json";
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 5);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);

$result = curl_exec ($curl);
$err_status = curl_error($curl);

curl_close ($curl);
$characters = json_decode($result,true);

//...logic goes here to display the data...

上面的代码运行正常.但是,它偶尔会失败(或多次刷新/加载页面时),并显示错误"无法连接到testing-3be52.firebaseio.com端口443:连接被拒绝".几分钟后,此错误会自动修复.

Above piece of code is working fine. However, it failing occasionally (or when the page is refreshed/loaded multiple times), with error "Failed to connect to testing-3be52.firebaseio.com port 443: Connection refused". This error automatically gets fixed after few minutes.

我在Google上搜索了很多,但是找不到任何解决方案.您的帮助将不胜感激!

I googled a lot but couldn't find any solution. Your help will be much appreciated!

推荐答案

听起来服务器间歇性地只是不想和你说话.如果是这样,那么您在PHP客户端上可能无能为力.

It sounds like the server intermittantly just doesn't want to talk to you. If so, there's probably not too much you can do from your PHP client.

建议:

增加连接超时>> 5

Increase your connect timeout >> 5

这篇关于无法连接到testing-3be52.firebaseio.com端口443:连接被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆