Доброго времени суток.
Array ( [0] => HTTP/1.1 302 Moved Temporarily [Server] => Array ( [0] => nginx/1.4.3 [1] => nginx/1.4.3 ) [Date] => Array ( [0] => Thu, 28 Aug 2014 17:44:06 GMT [1] => Thu, 28 Aug 2014 17:44:08 GMT ) [Content-Type] => Array ( [0] => text/html; charset=utf-8 [1] => video/mp4 ) [Connection] => Array ( [0] => close [1] => close ) [X-Powered-By] => PHP/5.4.21 [Set-Cookie] => Array ( [0] => PHPSESSID=a6cbd775e96de9c2557812f29cfcbdeb; path=/ [1] => video_58785=1; expires=Thu, 28-Aug-2014 18:44:06 GMT; path=/ ) [Expires] => Array ( [0] => Thu, 19 Nov 1981 08:52:00 GMT [1] => Thu, 31 Dec 2037 23:55:55 GMT ) [Cache-Control] => Array ( [0] => no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [1] => max-age=315360000 ) [Pragma] => no-cache [Location] =>
d0.faptv.net/s/uQAtlVkETLhraRQS56Cvug/1409334246/5... [1] => HTTP/1.1 200 OK [Content-Length] => 66962160 [Last-Modified] => Thu, 28 Aug 2014 16:25:02 GMT [Accept-Ranges] => bytes )
*************************************
$url = 'http://faptv.net/site/download/video/21717/';
$h = get_headers($url,1);
$file = $h['Location'];
if($len = get_headers($file,1)){
//print_r($len);
if($len[0] == 'HTTP/1.1 200 OK'){
if(ob_get_level()){ob_end_clean();}
if($len['Content-Type'] == 'video/mp4'){$ext='mp4';}
if($len['Content-Type'] == 'video/3gpp'){$ext='3gp';}
header('Content-Description: File Transfer');
header('Content-Type: '.$h['Content-Type'][1]);
header('Content-Disposition: attachment; filename='.$_SERVER['HTTP_HOST'].'_'.rand(00000,99999).'.'.$ext);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: '.$h['Content-Length']);
readfile($file);
exit;
}
}
else{header('location: '.$url); exit;}
проблема в том что размер файла не отображается в браузере при скачивании, т.е отображает то что скачало.