1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
<?php
$_GET['link'] = "http://tb.net//download/redirect/".$_GET['link'];
// URL to file (link)
$file = $_GET['link'];
// recupere la taille du fichier
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_exec($ch);
$size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
curl_close($ch);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($_GET['link']));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length:' . $size);
// header('HTTP/1.0 206 Partial Content');
// header('Status: 206 Partial Content');
// header('Content-Disposition: attachment; filename="' . basename($_GET['link']) . '"');
// header('Accept-Ranges: bytes');
// header('Content-Range: bytes '.$debut.'-'.$fin.'/'.$taille);
// header('Content-Length: ' . $taille);
readfile($_GET['link']);
exit;
?> |
Partager