I\'m pretty new to cURL so I\'ve been struggling with this one for hours. I\'m trying to download the source of a website in an iframe using cURL and while it\'s loading to
To use the callback inside a class, you must do it like this:
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, array($this, 'progress'));
or if using static functions, like this:
curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, array('self', 'progress'));
... to a callback function to do whatever you need:
private static function progress($resource, $downloadSize, $downloaded, $uploadSize, $uploaded)
{
// emit the progress
Cache::put('download_status', [
'resource' => $resource,
'download_size' => $downloadSize,
'downloaded' => $downloaded,
'upload_size' => $uploadSize,
'uploaded' => $uploaded
], 10);
}