Download multiple files from a website

Posted on 2007-08-10
Medium Priority
Last Modified: 2013-12-13

I am trying to write a script in php that will input a url such as http://www.ndbc.noaa.gov/data/adcp_raw_data/42369/2006/01/17/

Which has many files that are availble for download.  Then it will pharse the page and dump the files on my hard drive.  Right now we just have to right click and save each file which for hundreds of files that could take a while.

Basically I know the code to pharse the page and strip the url to the file. But I am not sure of a way to download each url with out it prompting where to save each file.

Question by:fixitben
LVL 48

Accepted Solution

hernst42 earned 2000 total points
ID: 19673719
You save the content of those urls like you got that remote page or you use copy;

copy('http://www.ndbc.noaa.gov/data/adcp_raw_data/42369/2006/01/17/423691200601171400.bin', '/local/file/name/localfilename');

Author Comment

ID: 19674025
That is exactly what I was looking for.


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month16 days, 4 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question