Posted By

mattneary on 07/18/11


Tagged

Bash exec YouTube


Versions (?)

Youtube Downloader


 / Published in: PHP
 

Requires youtube-dl to be in the directory.

  1. function serveFile( $file ){
  2.  
  3. $output = '';
  4.  
  5. $prep = `cd /Applications/XAMPP/xamppfiles/htdocs/download`;
  6.  
  7. $fp = popen('./youtube-dl -c -w '.$file.' 2>&1', "r");
  8.  
  9. while(!feof($fp))
  10.  
  11. {
  12.  
  13. $myLine = fread($fp, 1024);
  14.  
  15. $buffer = $myLine;
  16.  
  17. echo $myLine;
  18.  
  19. $output .= $buffer."...\n";
  20.  
  21. }
  22.  
  23. fclose($fp);
  24.  
  25. return $output;
  26.  
  27. }

Report this snippet  

You need to login to post a comment.