- WebDownload (PHP)
+ Responder ao Tópico
-
WebDownload (PHP)
Eu fiz um scriptzinho que utilizasse do wget para baixar arquivos via uma interface web.
muito simples, sem muitas funcionalidades, ele consegue ler o arquivo de log, entretanto nao o apaga. so adiciona ao mesmo :-)
eu nao sei c ja tem (deve ter) mas como eu prescisei dele eu fiz em php (demorou um certo tempinho)
pois eu nao sou programdor :-) se alguem gostar ou tiver algum ideia de melhoria, mais funcionalidades.. como agendar hora para download, mostrar lista de logs, etc etc :-) eu fico agradecido.
--- segue o script:
* index.html
<HTML>
<TITLE>Download Web Page</title>
<BODY>
<FORM ACTION="download.php" METHOD=POST>
<P>URL:
<INPUT TYPE="text" size=50 NAME="url">
<BR>
<P> Speed Limit:
<SELECT NAME="speed" size=1>
<OPTION VALUE="MAX"> No Limit
<OPTION VALUE="5k"> 5 kbits
<OPTION VALUE="10k"> 10 kbits
<OPTION VALUE="15k"> 15 kbits
<OPTION VALUE="20k"> 20 kbits
</select>
<BR><BR><BR>
<INPUT TYPE="Submit">
</form>
<FORM ACTION="viewdl.php" METHOD=GET>
<BR><BR><P> View log file?
<INPUT TYPE="Submit" NAME=vwlog VALUE=Yes>
</form>
</body>
</html>
- end of file
* download.php
<HTML>
<TITLE> Download Web Page </title>
<BODY>
<?php
if ( strcmp($speed, "MAX") ) {
$command = `/usr/bin/wget -b -a wget-log $url`;
shell_exec($command);
} else {
$command = `/usr/bin/wget -b -a wget-log --limit-rate=$speed $url`;
shell_exec($command);
}
print("Starting to downloading file ... <BR>");
print("<BR>");
print("URL: $url<BR>");
print("Speed: $speed per second<BR>");
?>
</body>
</html>
- end of file
* viewdl.php
<HTML>
<TITLE> View Log File (Wget Download) </title>
<BODY>
<?php
$file = "/var/www/default/admin/webdl/wget-log";
$fd = fopen($file, "r") or die("Couldnt open file: $file");
while (!feof ($fd))
{
$buffer = fgets($fd, 4096);
// echo $buffer;
print("$buffer<BR>");
}
fclose($fd);
?>
</body>
</html>
*** Desculpe se a identacao ficar um lixo, mas eu acho q esse forum retira os espacos em branco iniciais :-) se alguem quiser eles mais "bontinhos" eu posso mandar via email
Obrigado,
<p> Better Safe Than Sorry </p>
[ Esta mensagem foi editada por: mistymst em 04-03-2003 15:36 ]
[ Esta mensagem foi editada por: mistymst em 04-03-2003 15:38 ]
-
WebDownload (PHP)
Made pramim esse seu script quero dar uma olhada com calma nele e quem sabe melhorar um pouco.
[email protected]
Marcos Amorim
-
WebDownload (PHP)
manda para mim tbm...
[email protected]