bucle de php curl
function Curl($url){
$total_curl = 1;
$isRunning = true;
$sleep = 1;
while ($isRunning){
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_REFERER, $this->url ?? $url);
//for debug only!
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_TIMEOUT,10);
$resp = curl_exec($curl);
if((!$resp || curl_errno($curl))){
if($total_curl > 3){
$isRunning = false;
}
sleep($sleep);
}
curl_close($curl);
$total_curl++;
}
return $resp;
}
Ramil Huseynov