ho script php che consente di scaricare video da youtube con php.
quando provo a eseguirlo mi compaiono queste tre righe all'infinito:codice:<body> <form action="" method="post"> Inserisci il percorso del file da scaricare (http://www.youtube.com/watch?v=UF8uR6Z6KLc) Per esempio, se il link è http://www.youtube.com/watch?v=UF8uR6Z6KLc sarà necessario inserire watch?v= UF8uR6Z6KLc <input type="text" name="link" size="50" /> <input type="submit" value="Preleva link" /> <?php if (!empty($_POST['link'])) { $uri = ($_POST['link'][0] != '/' ? "/" . trim($_POST['link']) : trim($_POST['link'])); $sito = 'www.YouTube.com'; $f = getFile($uri, $sito); if ($f) { $f = explode("fmt_url_map\": \"", $f); $d = explode("\"", $f[1]); $link = explode("|", urldecode($d[0])); echo "<center><h4>Link to file:</h4> <textarea cols='50' rows='10'>" . urldecode($link[2]) . "</textarea></center>"; } else { echo "Bad link"; } } function getFile($url, $sito) { $other_info = "User‐Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.9) Gecko/2008052906 Firefox/3.0\r\n" . "Accept‐Language: it‐it,it;q=0.8,en‐us;q=0.5,en;q=0.3\r\n" . "Keep‐Alive: 300\r\n" . "Connection: Keep‐Alivern\r\n\r\n"; if (!($sock = fsockopen($sito, 80))) { die("Errore connessionen"); } fputs($sock, "GET $url HTTP/1.1\r\n" . "Host: $sito\r\n" . $other_info); $f = ""; while (!feof($sock)) { $f .= fgets($sock); fclose($sock); } return $f; } ?> </form> </body>
ho provato con vari video diversi.codice:Warning: feof(): 1 is not a valid stream resource in /web/htdocs/www.mattepuffo.com/home/vyt/index.php on line 37 Warning: fgets(): 1 is not a valid stream resource in /web/htdocs/www.mattepuffo.com/home/vyt/index.php on line 38 Warning: fclose(): 1 is not a valid stream resource in /web/htdocs/www.mattepuffo.com/home/vyt/index.php on line 39
l'utimo è questo: http://www.youtube.com/watch?v=PBC1Y...ture=topvideos
ho inserito solo: watch?v=PBC1Y_TDyEI&feature=topvideos
dov'è il problema??

Rispondi quotando