cURL / Mailing Lists / curl-users / Single Mail

curl-users

What's the cURL syntax to download a binary file from a download script URL

From: Larry Johnson <larry_at_lgjconsulting.com>
Date: Thu, 27 May 2004 19:49:36 -0700

Hi,

 

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.

 

Here are the specifics. (Actual URL is private; replaced it with
xxx.xxx.xxx)

 

This is like the URL I am working with. It works in IE but as yet I have
failed to use cURL to successfully download the file 3940170.bin

http://xxx.xxx.xxx/scripts/cust/download.php?path=/place/projects/_3356/stor
ed/
<http://xxx.xxx.xxx/scripts/cust/download.php?path=/place/projects/_3356/sto
red/&name=3940170.bin&projectID=3356&fShow=>
&name=3940170.bin&projectID=3356&fShow=

 

The IE headers look like this

 

GET
/scripts/cust/download.php?path=/place/projects/_3356/stored/&name=3940170.b
in&projectID=3356&fShow= HTTP/1.1

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword,
application/x-shockwave-flash, */*

Accept-Language: en-us

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR
1.1.4322)

Host: xxx.xxx.xxx

Connection: Keep-Alive

Cookie: PHPSESSID=29792964b8b5d26399e5062d2159b8e8

 

 

HTTP/1.1 200 OK

Date: Fri, 28 May 2004 01:38:25 GMT

Server: Apache/2.0.48 (Unix) PHP/4.3.5

X-Powered-By: PHP/4.3.5

Set-Cookie: PHPSESSID=29792964b8b5d26399e5062d2159b8e8; path=/

Content-Length: 0

Content-Disposition: attachment; filename=3940170.bin

Content-Transfer-Encoding: binary

Keep-Alive: timeout=15, max=100

Connection: Keep-Alive

Content-Type: application/octet-stream

 

 

And the headers from my attempts with cURL are

 

HTTP/1.1 200 OK

Date: Fri, 28 May 2004 02:44:54 GMT

Server: Apache/2.0.48 (Unix) PHP/4.3.5

X-Powered-By: PHP/4.3.5

Set-Cookie: PHPSESSID=f783ce8bf60603ce516f30ba1b8707d0; path=/

Content-Disposition: attachment; filename=

Content-Transfer-Encoding: binary

Content-Type: application/octet-stream

 

 

How can I get cURL to imitate what IE does?

 

Thanks for any help of this.

 

-Larry

 

 

 

 

 
Received on 2004-05-28