Page 1 of 1

Download... a question for the experts

Posted: Mon Jun 24, 2002 8:44 am
by romeo
I know it's possable, just not a clue how I would even start it...

To feed a script a URL and have it pull down all the links to .zip files and download the .zip files to the server...

Does anyone know how, or have a clue where to find a script like this

Re: Download... a question for the experts

Posted: Mon Jun 24, 2002 8:49 am
by will
romeo wrote:I know it's possable, just not a clue how I would even start it...

To feed a script a URL and have it pull down all the links to .zip files and download the .zip files to the server...

Does anyone know how, or have a clue where to find a script like this
(assuming apache is used), this would depend on the "Indexes" option of the apache configuration. This directive allows/disallows the user to view the entire contents of a directory if there is no DirectoryIndex file present (such as index.html or index.php). if this is a server that you administer, i'd be happy to show you how to set apache to allow such a thing

<edit>
oops, i guess i misread the question...i was thinking you were looking to download all zip files in a given directory
</edit>

It's possible.

Posted: Mon Jun 24, 2002 9:39 am
by BDKR
Just retrieve the document and parse it for <a> and </a> tags. When it finds those, parse for file type. Make a list of the hits (so to speak), then go back and download those files.

Check out this link. http://www.php.net/manual/en/function.fsockopen.php.
Look at example one and build from there.

Later on,
BDKR (TRC)

So like this

Posted: Mon Jun 24, 2002 10:09 pm
by romeo
The First part I think I can handle.. the sockets however confuse me...

does

Code: Select all

<?php
$fp = fsockopen ("www.example.com", 80, $errno, $errstr, 30);
if (!$fp) &#123;
    echo "$errstr ($errno)<br>\n";
&#125; else &#123;
    fputs ($fp, "GET / HTTP/1.0\r\nHost: www.example.com/tough.zip");
    while (!feof($fp)) &#123;
        echo fgets ($fp,128);
    &#125;
    fclose ($fp);
&#125;
?>

download the zip file?

Posted: Tue Jun 25, 2002 9:57 pm
by romeo
bump

Posted: Fri Jun 28, 2002 6:45 pm
by romeo
()()()

Posted: Fri Jun 28, 2002 10:46 pm
by jason
Why not try it out and tell us if it does?