Skip to content

Instantly share code, notes, and snippets.

@cooliscool
Created June 13, 2018 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cooliscool/2b0e0e0292a33af1f928f61ae88e5d3c to your computer and use it in GitHub Desktop.
Save cooliscool/2b0e0e0292a33af1f928f61ae88e5d3c to your computer and use it in GitHub Desktop.
Youtube Downloader API in PHP
// Author : Mohammed Ajmal
// github.com/cooliscool
// GNU Public License
<?php
if(isset($_GET['v'])){
// $download = exec('youtube-dl '.$_GET['v']);
$comm = 'youtube-dl '.$_GET['v'].' 2>&1';
while (@ ob_end_flush());
$proc = popen($comm, 'r');
echo "<pre>";
while(!feof($proc)){
echo fread($proc,4096);
@ flush();
}
echo "</pre> ";
}
else{
$output= shell_exec('ls');
echo "<pre> $output </pre> ";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment