I am sending about 600 Curl requests to different websites and at some point my page stop/break and here is the error I am getting.
Website.com unexpectedly closed the connection. ERR_INCOMPLETE_CHUNKED_ENCODING
I am looping the function below through all my 600 websites.
function GetCash($providerUrl, $providerKey){
$url = check_protocol($providerUrl);
$post = [
'key' => Decrypt($providerKey),
'action' => 'balance'
];
// Sets our options array so we can assign them all at once
$options = [
CURLOPT_URL => $url,
//CURLOPT_POST => false,
CURLOPT_POSTFIELDS => $post,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 5,
];
// Initiates the cURL object
$curl = curl_init();
curl_setopt_array($curl, $options);
$json = curl_exec($curl);
curl_close($curl);
//Big variable of all the values
$services = json_decode($json, true);
//Check for invalid API response
if($services['error'] == "Invalid API key"){
return FALSE;
}else{
return $services['balance'];
}
return FALSE;
}