Failed to connect to testing-3be52.firebaseio.com port 443: Connection refused

北慕城南 提交于 2021-01-28 05:32:35

问题


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...

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.

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


回答1:


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.

SUGGESTION:

Increase your connect timeout >> 5



来源:https://stackoverflow.com/questions/48456535/failed-to-connect-to-testing-3be52-firebaseio-com-port-443-connection-refused

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!