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 smile.gif

plik video.php
  1. <?php
  2. if(isset($_GET['id']) && !empty($_GET['id'])) {
  3.  
  4. $url = 'http://netload.in/'.$_GET['id'].'.htm';
  5.  
  6. $login = '###';
  7. $haslo = '###';
  8.  
  9. $ch = curl_init();
  10. curl_setopt($ch, CURLOPT_URL, "http://www.netload.in/index.php");
  11. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  12. curl_setopt ($ch, CURLOPT_HEADER, 1);
  13. curl_setopt($ch, CURLOPT_POSTFIELDS, "txtuser=$login&txtpass=$haslo&txtcheck=login&txtlogin=Login");
  14. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  15. curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);
  16. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1');
  17. $page = curl_exec($ch);
  18.  
  19. preg_match_all('/Set-Cookie: (.*);/U',$page,$temp);
  20. $cookie = $temp[1];
  21. $cookie = implode('; ',$cookie);
  22. $ch = @curl_init();
  23. curl_setopt($ch, CURLOPT_URL, $url);
  24. curl_setopt($ch, CURLOPT_HEADER, 1);
  25. curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  26. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  27. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  28. curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 30);
  29. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1');
  30. $page = curl_exec( $ch);
  31. preg_match ( '/Set-Cookie: (.*);/', $page, $cook );
  32. if(preg_match ( '/Location: (.*)/', $page, $linkpre))
  33. $URL = trim ( $linkpre[1] );
  34. if(empty($URL))
  35. {
  36. echo "Zly link!";
  37. die;
  38. }
  39. $filesize = remote_size($URL, $this);
  40.  
  41. header('Content-type: video/mp4');
  42. header('Content-Disposition: attachment; filename="'.md5(date('YmD')).'.mp4"');
  43. header('Content-Length: '.$filesize);
  44. header("Content-Transfer-Encoding: binary");
  45.  
  46. $ch = curl_init();
  47. curl_setopt($ch, CURLOPT_URL, $URL);
  48. curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
  49. curl_exec($ch);
  50. curl_close($ch);
  51. }
  52. ?>


plik index.php
  1. <!-- 1. jquery library -->
  2. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  3.  
  4. <!-- 2. flowplayer -->
  5. <script src="flowplayer.min.js"></script>
  6.  
  7. <!-- 3. skin -->
  8. <link rel="stylesheet" type="text/css" href="skin/minimalist.css" />
  9.  
  10. <style>
  11. .flowplayer {
  12. width: 600px;
  13. height: 338px;
  14. }
  15. </style>
  16.  
  17. <div class="flowplayer" data-engine="flash">
  18. <video preload="none">
  19. <source type="video/mp4" src="video.php?id=dateick0P7p3qbG"/>
  20. </video>
  21. </div>
  22.  
  23. <script>
  24. // run script after document is ready
  25. $(function() {
  26.  
  27. // install flowplayer to an element with CSS class "player"
  28. $(".player").flowplayer({ swf: "/swf/flowplayer-.swf" });
  29.  
  30. });
  31. </script>