cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: how to choose or limit the size of what libcurl download?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 4 Dec 2007 10:41:03 -0800

On Tue, Dec 04, 2007 at 02:06:11PM +0000, hallouina-ml_at_yahoo.fr wrote:
> I download some webpage with this exemple :
>
> http://curl.haxx.se/lxr/source/docs/examples/getinmemory.c ,
>
> but sometime it download gif, jpg, mp3.... how to say to libcurl to only download html page please? or to limite the size of what libcurl download?
>
> thanks for you help! :)

You can send an HTTP "Accept: text/html" header to ask the server to send
only HTML, but the server might not obey. You can obtain the size from the
progress callback function and abort the download if the size is too large
for you, or do a NOBODY request first to get just the size and download
the file separately if the size is acceptable.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2007-12-04