View Single Post
Old 07-06-2005, 10:53 AM   #1 (permalink)
fp_unit
mike
 
Join Date: Jan 2005
Location: Ottawa, ON
Posts: 79
fp_unit is on a distinguished road
Downloading files with PHP

I'm in the process of contemplating a switch from Perl to PHP for this project we're working on. Its a document producer tool for our website - we need to host a bunch of documents in our database and when documents are uploaded in the producer tool, they automatically display on the website. I'm kind of the lead programmer on this project (OK - the only programmer) and I have a good idea how to go about doing it, but I think it would be easier to maintain down the road if I use a language with much better OO support (php). OO in Perl is weird, and I'm not going to lie and say I know how to design procedural systems well - I dont.

So my question about PHP is: how would I go about downloading files over the Internet? In Perl we used the wget() series of utilities and I'm wondering what the equivalent is in PHP4 or 5 (preferably at least PHP-4.3.xxx). I need a way to pass an HTTP or FTP URL such as http://random.website.org/path/file.pdf and have this function download the file to where I tell it, such as /var/docs/only_writable_directory/company and report back results to me.

Thanks
fp_unit is offline   Reply With Quote