curl-library
Re : how to choose or limit the size of what libcurl download?
Date: Tue, 4 Dec 2007 23:41:32 +0000 (GMT)
thanks! I thinks changing the headers is the best way to do it. I read the documentation :
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
but it's hard to choose what option to modify to change the "Accept: text/html"
CURLOPT_HTTPHEADER? CURLOPT_HEADER? CURLOPT_HEADERFUNCTION? CURLOPT_WRITEHEADER?
unfortunatly my english is a little bit limited and it's hard for me to understand the subtility of the different previous options. If someone could help me to choose the right option, it will be nice.
Thanks again for you help and your attention! :)
----- Message d'origine ----
De : Dan Fandrich <dan_at_coneharvesters.com>
À : curl-library_at_cool.haxx.se
Envoyé le : Mardi, 4 Décembre 2007, 19h41mn 03s
Objet : Re: how to choose or limit the size of what libcurl download?
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 _____________________________________________________________________________ Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! MailReceived on 2007-12-05