Forum Moderators: coopster

Message Too Old, No Replies

Downloading file via curl when url not a direct link?

how?

         

ajs83

5:40 am on Jan 20, 2006 (gmt 0)

10+ Year Member



I am trying to use CURL to log into a site, download a file, and send the results. So far I have gotten it to log-in and send results (based on sample data), but I cannot get the file to download.

For example, the url is in a format similar to the link below When you click it, it redirects somewhere and provides REPORTS.ZIP (note the bolded area of the example link).

http://www.example.com/file.php?date=2006/01/18&date2=2006/01/19&file=REPORTS&info=all

The problem is that the url is not a direct link and when clicked, it prompts any (standard) browser to download the (zip) file. When I tried using wget, it downloads file.php which does no good.

What do I need to do for it to download and write the file to my local directory?

ajs83

8:39 pm on Jan 20, 2006 (gmt 0)

10+ Year Member



anyone?

jatar_k

8:53 pm on Jan 20, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



what happens when you use curl on the file, you said wget gets file.php (which is also strange) but didn't mention what happens with curl.

you could also look at [curl.haxx.se...] and see if there is any specific thing to do with file retrieval, especially zip.

I would also read through the comments on these pages
[php.net...]
[php.net...]

I know they're longbut there is very often valuable information in there

ajs83

9:56 pm on Jan 20, 2006 (gmt 0)

10+ Year Member



I'm using curl to imitate the valid login which works, but then I try using

wget http://www.example.com/file.php?date=2006/01/18&date2=2006/01/19&file=REPORTS&info=all

it gives me file.php