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'); ...@@ -202,7 +202,7 @@ require_once (__DIR__.'/keys.php');
CURLOPT_SSL_VERIFYPEER =>false, CURLOPT_SSL_VERIFYPEER =>false,
CURLOPT_SSL_VERIFYHOST =>false, CURLOPT_SSL_VERIFYHOST =>false,
CURLOPT_NOPROGRESS => false , CURLOPT_NOPROGRESS => false ,
CURLOPT_PROGRESSFUNCTION => 'progress', CURLOPT_PROGRESSFUNCTION => array($this, 'curlprogress'),
CURLOPT_HTTPHEADER => array( CURLOPT_HTTPHEADER => array(
'Authorization: Bearer '.$arSettings["token"], 'Authorization: Bearer '.$arSettings["token"],
'Content-Type: application/json' 'Content-Type: application/json'
...@@ -268,8 +268,10 @@ require_once (__DIR__.'/keys.php'); ...@@ -268,8 +268,10 @@ require_once (__DIR__.'/keys.php');
return $result; return $result;
function progress($resource,$download_size, $downloaded, $upload_size, $uploaded)
{ }
public function curlprogress($resource,$download_size, $downloaded, $upload_size, $uploaded){
if($download_size > 0) if($download_size > 0)
// echo $downloaded / $download_size * 100; // echo $downloaded / $download_size * 100;
$percDwn = $downloaded / $download_size * 100; $percDwn = $downloaded / $download_size * 100;
...@@ -278,8 +280,6 @@ require_once (__DIR__.'/keys.php'); ...@@ -278,8 +280,6 @@ require_once (__DIR__.'/keys.php');
flush(); flush();
sleep(1); // just to see effect sleep(1); // just to see effect
} }
}
/** /**
* @var $data mixed * @var $data mixed
* @var $encoding boolean true - encoding to utf8, false - decoding * @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