Home » Php » php – firebaseio.com refusing connections after many requests

php – firebaseio.com refusing connections after many requests

Posted by: admin February 25, 2020 Leave a comment


I use PHP CURL for making changes to the Firebase database. After many curl requests, suddenly, Failed to connect to something.firebaseio.com port 443: Connection refused error occours. After few hours, it starts working again.

Following is the curl script in php

 $url = 'https://something.firebaseio.com/iochatting/roomchats/data.json?auth=private_key';
 $json = json_encode($msg);
 $headers = array();
 $headers[] = 'Content-Type: application/json';
 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL, $url);
 curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
 curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
 curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
 curl_setopt($ch, CURLOPT_VERBOSE, true);
 curl_setopt($ch, CURLOPT_TIMEOUT, 20500);
 $response = curl_exec($ch);
 if ($response === FALSE) {

This code works fine most of the time but suddenly all connection requests are rejected.

Also, i have tried https://github.com/kreait/firebase-php , this too stops suddenly.

I want the curl to work not the php-sdk. Is there anyway ? Is google refusing server request ?

When the connections are rejected when sending request normally, if i use proxy in of port 443. It works again for few times.

How to&Answers: