Commit 234bcd55 authored by Kulya's avatar Kulya 😊

Billz curl req add progress func2

parent dfffb611
......@@ -202,7 +202,7 @@ require_once (__DIR__.'/keys.php');
CURLOPT_SSL_VERIFYPEER =>false,
CURLOPT_SSL_VERIFYHOST =>false,
CURLOPT_NOPROGRESS => false ,
CURLOPT_PROGRESSFUNCTION => 'progress',
CURLOPT_PROGRESSFUNCTION => array($this, 'curlprogress'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer '.$arSettings["token"],
'Content-Type: application/json'
......@@ -268,18 +268,18 @@ require_once (__DIR__.'/keys.php');
return $result;
function progress($resource,$download_size, $downloaded, $upload_size, $uploaded)
{
if($download_size > 0)
// echo $downloaded / $download_size * 100;
$percDwn = $downloaded / $download_size * 100;
echo "\r Загружено: \033[32m".$percDwn."% \033[0m [\033[36m".$downloaded."\033 из 0m/".$download_size."...";
ob_flush();
flush();
sleep(1); // just to see effect
}
}
public function curlprogress($resource,$download_size, $downloaded, $upload_size, $uploaded){
if($download_size > 0)
// echo $downloaded / $download_size * 100;
$percDwn = $downloaded / $download_size * 100;
echo "\r Загружено: \033[32m".$percDwn."% \033[0m [\033[36m".$downloaded."\033 из 0m/".$download_size."...";
ob_flush();
flush();
sleep(1); // just to see effect
}
/**
* @var $data mixed
* @var $encoding boolean true - encoding to utf8, false - decoding
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment