Made “CURLOPT_TIMEOUT” variable, set it to 45 secs by default

This commit is contained in:
pezcurrel 2022-12-16 21:24:42 +01:00
parent d75a6445ae
commit fe99014208

View file

@ -1,6 +1,6 @@
<?php
function getfc($url,$timeout,$headers=[]) {
function getfc($url,$conntimeout,$timeout=45,$headers=[]) {
$curli=curl_init();
// i 2 qui sotto servono a far sì che ctrl+c sia intercettato a monte
/*curl_setopt($curli,CURLOPT_NOPROGRESS,false);
@ -8,8 +8,8 @@ function getfc($url,$timeout,$headers=[]) {
curl_setopt($curli,CURLOPT_URL,$url);
curl_setopt($curli,CURLOPT_RETURNTRANSFER,true);
curl_setopt($curli,CURLOPT_FAILONERROR,true);
curl_setopt($curli,CURLOPT_TIMEOUT,30);
curl_setopt($curli,CURLOPT_CONNECTTIMEOUT,$timeout);
curl_setopt($curli,CURLOPT_CONNECTTIMEOUT,$conntimeout);
curl_setopt($curli,CURLOPT_TIMEOUT,$timeout);
curl_setopt($curli,CURLOPT_HTTPHEADER,$headers);
curl_setopt($curli,CURLOPT_HEADER,true);
curl_setopt($curli,CURLOPT_ENCODING,'');