curl-library
Re: downloading zip file via aspx page
Date: Wed, 16 Jun 2010 18:03:02 +0200
On 16 June 2010 11:04, Claudio_Unige <claudiounige_at_gmail.com> wrote:
>
> On Wed, Jun 16, 2010 at 10:18 AM, Daniel Stenberg <daniel_at_haxx.se> wrote:
>>
>> On Wed, 16 Jun 2010, Claudio_Unige wrote:
>>
>>> Sorry I must have messed up, there is no actual popup in the html or
>>> javascript code, it is as if the server after the html page sends more stuff
>>> (I dont know aspx at all). I believe it is something like a request with
>>> type octet stream... Unfortunately I cannot be more precise since I really
>>> dont know aspx nor have the source available.
>>
>> As usual, you can just snoop what your browser does with a plugin such as
>> LiveHTTPHeaders or similar, and then you mimic those requests (closely) with
>> libcurl.
>
> Hi,
> I didnt know LiveHTTPHeader, I just used wireshark. Now everything is
> clearer the website is sending:
>
> Content-Disposition: Attachment; filename="myfile.zip"
This is not the part you should be looking for. Look for the request
from the browser just before that and then change your program to make
libcurl make the same request.
> At least I understood how it works now Ill go through the libcurl docs to
> see how to retrieve that file and save it in memory or in a File pointer.
Retrieving that is the same as retrieving anything else. The point is
you have to tell libcurl to make the request that results in the
server sending back that response. It won't happen by itself.
If, however, the initial response from the server contains a Location:
header, then Firefox will automatically follow that, whereas libcurl
will not unless you tell it to follow redirects.
-- Michael Wood <esiotrot_at_gmail.com> ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-06-16