views:

447

answers:

1

Hi there,

I’m writing a command line PHP console script to watch for new URLs and launch (large) downloads for a client’s project I am working on. The client is currently manually downloading them with a slightly specific wget command and ideally would like to stay with that.

I was wondering what the best way to call wget from PHP would be and to watch for either a completed download or any errors that come along. At the moment, I’m using a basic shell_exec however this isn’t suitable for a production environment.

Any suggestions at all would be extremely helpful.

Thanks in advance.

+3  A: 

Something you might want to consider is using curl instead of wget. libcurl is integrated into PHP well - with all the shabang of error reporting.

Alex
The only problem with cURL is that I’m not too sure how it would stand up with larger downloads and the specific needs of my client.
Pep
I've used curl with multi-dozen-megabyte downloads; curl can support almost anything any other HTTP client can support (cookies, HTTPS, etc)
Alex
Could you provide some example code, specifically on file downloads?
Pep