span style="color: #0000BB"><?php$url = 'domain.com/file.3gp';$targetFile = fopen('m.3gp', 'w');$ch = curl_init($url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_NOPROGRESS, false);curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback');curl_setopt($ch, CURLOPT_FILE, $targetFile);curl_exec($ch);fclose($ch);function progressCallback($download_size, $downloaded_size, $upload_size, $uploaded_size){ static $previousProgress = 0; if ( $download_size == 0 ) $progress = 0; else $progress = round($downloaded_size * 100/$download_size);}?> |