Hello, I would like to help you, to try to solve the following problem, I created a script that allows you to get the direct link from a host of online videos upload, the process works, but I do not know why the loop does not repeat it's working. When I put several links on and generated the first link in the listing.
I would like your help to correct this error.
Below is my code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form id="form1" name="form1" method="post" action="links.php">
<p>
<textarea name="url" cols="100" rows="20" id="urls"></textarea>
</p>
<p>
<input type="submit" name="gerar" id="gerar" value="Gerar urls de Link direto" />
</p>
</form>
<?php
$dados = $_POST['url'];
// Aplicva os parametros de Explode para contar os itens
$url1 = count(explode("/n", $dados));
$url2 = array_map('trim', explode("/n", $dados));
// Verifica se o valor total e subtrai caso seja maior que 1 para fazer o loop perfeitamente
if ($url1 > 1) { $soma = $url1 -1; }
echo '<textarea cols="200" rows="20" id="input">';
// Aplica for colocando o valor total de links para fazer o loop
for ($i = 0; $i <= $soma; $i++) {
// Caso seja menor que a soma aplica quebra de linha
if ($i < $soma) {
// Aplica a aparição da url e codifica para aparecer a url de link direto com quebra de linha
$dados = $url2[$i];
$url3 = explode('/', $dados);
$aniteca = 'https://meusite.com/?v='.$url3[5];
$html = file_get_contents($aniteca);
$valor1 = explode("'720p':[{'type':", $html);
$valor1 = explode("mp4'}],", $valor1[1]);
$valor1 = explode("'video/mp4', 'src': '", $valor1[0]);
echo $valor1[1].'mp4'."\n";
} else {
// Aplica a aparição da url e codifica para aparecer a url de link direto sem quebra de linha
$dados = $url2[$i];
$url3 = explode('/', $dados);
$aniteca = 'https://meusite.com/?v='.$url3[5];
$html = file_get_contents($aniteca);
$valor1 = explode("'720p':[{'type':", $html);
$valor1 = explode("mp4'}],", $valor1[1]);
$valor1 = explode("'video/mp4', 'src': '", $valor1[0]);
echo $valor1[1].'mp4';
}
}
echo '</textarea>';
?>
<br/>
<button id="copy-button">Copiar todos as urls</button>
<script>
var input = document.getElementById("input");
var button = document.getElementById("copy-button");
button.addEventListener("click", function (event) {
event.preventDefault();
input.select();
document.execCommand("copy");
});
</script>
</body>
</html>