Youtube Downloader


/ Published in: PHP
Save to your folder(s)

Requires youtube-dl to be in the directory.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.