curl-users
RE: What's the cURL syntax to download a binary file from a download script URL
Date: Fri, 28 May 2004 10:43:03 -0700
Thanks for the input. I finally got it working.
My URL was a bit off so I was getting zero bytes back and it looks like I
needed to escape the "&" on the command line.
It turns out that this site doesn't even care about the cookies, so I
believe I found a security.
Thanks again,
Larry
-----Original Message-----
From: curl-users-bounces_at_cool.haxx.se
[mailto:curl-users-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Friday, May 28, 2004 12:05 AM
To: curl tool talk
Cc: larry.johnson_at_lgjconsulting.com
Subject: Re: What's the cURL syntax to download a binary file from a
download script URL
On Thu, 27 May 2004, Larry Johnson wrote:
> I would like to automate a download of a binary file using cURL.
>
> The problem that I run into is the URL downloads the file fine using IE
but
> when I use cURL nothing gets downloaded. I've been banging my head on this
> for a couple of days now without success.
...
> The IE headers look like this
n>
> GET
>
/scripts/cust/download.php?path=/place/projects/_3356/stored/&name=3940170.b
> in&projectID=3356&fShow= HTTP/1.1
...
> Cookie: PHPSESSID=29792964b8b5d26399e5062d2159b8e8
Obviously your browser had already received a cookie for this so it could
send
it like this. That means you did not start "recording" what IE does from the
start.
Remove all cookies (from this site) again, start recording and start all
over.
> HTTP/1.1 200 OK
>
> Set-Cookie: PHPSESSID=29792964b8b5d26399e5062d2159b8e8; path=/
> Content-Length: 0
> Content-Type: application/octet-stream
... is this really the working download response headers? It says the
content
is zero bytes!
> And the headers from my attempts with cURL are
...
> Set-Cookie: PHPSESSID=f783ce8bf60603ce516f30ba1b8707d0; path=/
> Content-Disposition: attachment; filename=
> Content-Transfer-Encoding: binary
> Content-Type: application/octet-stream
Hey look, in this response you get a cookie set. This is probably that
request
you left out from the IE-recording. If I would guess, I'd say that you need
this cookie set first and then you can request the file if you pass on this
cookie in the file-retrieving request.
> How can I get cURL to imitate what IE does?
Pay attention to cookies. Check the *full* IE sequence. Cross your fingers!
;-)
-- Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se Dedicated custom curl help for hire: http://haxx.se/curl.htmlReceived on 2004-05-28