Witam.
Mam z plikiem video.php?id=xxx gdyż gdy na niego wejdę zaczyna się normalnie pobierać plik MP4 ale gdy dodam go w odtwarzaczu (plik 'index.php') to nie załapuje wideo i wyświetla błąd.
P.S.
Proszę niezwracać uwagi na funkcje $filesize = remote_size($URL, $this); gdyż jest poprawna
plik video.php
<?php
if(isset($_GET['id']) && !empty($_GET['id'])) {
$url = 'http://netload.in/'.$_GET['id'].'.htm';
$login = '###';
$haslo = '###';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.netload.in/index.php");
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "txtuser=$login&txtpass=$haslo&txtcheck=login&txtlogin=Login");
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1');
$page = curl_exec($ch);
preg_match_all('/Set-Cookie: (.*);/U',$page,$temp);
$cookie = $temp[1];
$cookie = implode('; ',$cookie);
$ch = @curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1');
$page = curl_exec( $ch);
preg_match ( '/Set-Cookie: (.*);/', $page, $cook );
if(preg_match ( '/Location: (.*)/', $page, $linkpre))
$URL = trim ( $linkpre[1] );
if(empty($URL))
{
echo "Zly link!";
die;
}
$filesize = remote_size($URL, $this);
header('Content-type: video/mp4');
header('Content-Disposition: attachment; filename="'.md5(date('YmD')).'.mp4"');
header('Content-Length: '.$filesize);
header("Content-Transfer-Encoding: binary");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $URL);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_exec($ch);
curl_close($ch);
}
?>
plik index.php
<!-- 1. jquery library -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<!-- 2. flowplayer -->
<script src="flowplayer.min.js"></script>
<!-- 3. skin -->
<link rel="stylesheet" type="text/css" href="skin/minimalist.css" />
<style>
.flowplayer {
width: 600px;
height: 338px;
}
</style>
<div class="flowplayer" data-engine="flash">
<video preload="none">
<source type="video/mp4" src="video.php?id=dateick0P7p3qbG"/>
</video>
</div>
<script>
// run script after document is ready
$(function() {
// install flowplayer to an element with CSS class "player"
$(".player").flowplayer({ swf: "/swf/flowplayer-.swf" });
});
</script>