https://www.icyphoenix.com/viewtopic.php?f=33&t=7867 ----------------------------------- Mighty Gorgon Sat 04 Jun, 2011 10:47 PHP Files Downloader (Needs A Files Sequence Or List) ----------------------------------- Today I would like to share with you a small script I coded yesterday because I found a good resources site to download from. I noticed that all files where named sequentially: 'file_001.zip', 'file_002.zip', ... 'file_xxx.zip' Instead of downloading files one by one by manually clicking and load pages, I decided to go using PHP. Here are the instructions and the code: [list][*]First make sure you have a local server on your pc or a remote server with PHP running. [*]Suppose you need to download a lof of files which are named sequentially from website: 'file_001.zip', 'file_002.zip', ... 'file_xxx.zip'. [*]Create on your local (or remote) server a folder called "downloader" (or any name you like) and put this file in that folder: [codeblock filename="downloader.php"]

Files

'); flush(); echo(''); echo('


Work Complete!!!'); page_footer(); exit; function page_header($page_title) { $encoding_charset = 'UTF-8'; echo('' . "\n"); echo('' . "\n"); echo('' . "\n"); echo(' ' . "\n"); echo(' ' . "\n"); echo(' ' . $page_title . '' . "\n"); echo('' . "\n"); echo('' . "\n"); echo('' . "\n"); } function page_footer() { echo('' . "\n"); echo('' . "\n"); echo(''); } function remote_file_exists($dir, $file) { $ret = exec('ls ' . $dir . ' | grep ' . $file); return (!empty($ret)); } ?>[/codeblock] [*]I have highlighted the portion of codes you will need to adjust, in particular you need to edit the remote folder where the files are [b]$folder_src = 'http://www.targetsite.com/';[/b] and the base name of the file [b]$filename_base_src = 'file_';[/b] [*]After having edited the file, you need to create a subfolder called [b]files[/b] in the folder you just created (if you have created a folder called [b]downloader[/b], you will then have this path: [b]downloader/files[/b]): make sure the files folder has CHMOD 0777 permissions. [*]If everything is fine you can then launch the file in your browser and just wait that it finishes to download all your files![/list] Enjoy! ----------------------------------- Informpro Sat 04 Jun, 2011 11:12 Re: PHP Files Downloader (Needs A Files Sequence Or List) ----------------------------------- Isn't that slow ? I can't remember exactly but cross-domain request are slow in PHP (and most because of the server) afaik. ----------------------------------- Mighty Gorgon Sat 04 Jun, 2011 11:12 Re: PHP Files Downloader (Needs A Files Sequence Or List) ----------------------------------- Do you think is faster clicking on 327 files manually? :lol: ----------------------------------- Informpro Sat 04 Jun, 2011 11:14 Re: PHP Files Downloader (Needs A Files Sequence Or List) ----------------------------------- Surely not, but using a real langage should be faster, even just for copying. I may benchmark if I find time to update my os then install VS.