How to execute shell cmd (python) using php and print all constant-updated outputs? -
i pretty new php actually. here's thing: want make simple web-shell well-known youtube-dl, made simple webpage , simple php page, trying use php execute youtube-dl , display outputs browser.
i've try command
thing , escapeshellcmd(), both of them can output first few lines of constant-updating outputs youtube-dl (and work other cmd "ls"), seems when first line, python script stop, no more updates, , there no downloaded video file on server.
btw, it's on ubuntu 14 lts.
so far, have tried these:
<?php $command = shell_exec('youtube-dl https://www.youtube.com/watch?v=z456k6ybeo0'); echo "<pre>$command</pre>"; ?>
and
<?php echo `youtube-dl https://www.youtube.com/watch?v=z456k6ybeo0` >
and
<?php $command = escapeshellcmd('youtube-dl https://www.youtube.co/watch?v=z456k6ybeo0'); $output = shell_exec($command); echo $output; ?>
both of them work "ls",but not working youtube-dl
try shell_exec
function:
<?php $output = shell_exec('ls -lart'); echo "<pre>$output</pre>"; ?>
Comments
Post a Comment