I am trying to create a simple page that downloads youtube videos with the help of youtube-dl app.
<form action="" method="post">
<input type="submit" name="youtubedl" value="dload YouTube">
<input type="text" name="addr" value="">
</form>
PHP part looks like this:
<?php
echo "<pre>";
$link = escapeshellarg($_GET["addr"]);
if(isset($_POST['youtubedl']))
{
$output=shell_exec("/usr/local/bin/youtube-dl $link");
echo $link;
echo $output;
}
?>
I think my variable is not getting passed onto PHP as echo $link is not producing any output.
error.log returns ERROR: u'' is not a valid URL
You are looking for addr
in $_GET
while it will be in $_POST
since you use method="post"
.