cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: CURL and cookies

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 10 Apr 2006 11:41:42 +0200 (CEST)

On Mon, 10 Apr 2006, Sebastian Hoffmann wrote:

> After a couple of hours of searching on the net, I feel a bit lost and am
> wondering whether anybody could help me out with a quick sample script. I
> have the feeling this is all pretty simple, but I'm quite new to CURL and a
> bit overwhelmed by the options. ;-)

What, there are only a little over one hundred of them! ;-P

> I am using Perl and WWW::Curl::Easy to download a set of web pages and I
> would like to use the cookies that are set by the remote server.

Just note that the perl binding is a product of its own merits and isn't
strictly curl not libcurl, but a layer between perl and libcurl.

> How do I store a cookie and how do I re-use it from within the Perl script?

We call it saving to a "cookiejar". This is -c with curl and CURLOPT_COOKIEJAR
with libcurl. You read cookies from a file with -b and CURLOPT_COOKIEFILE.

I generally recommend reading these for greater (lib)curl insights:

         http://curlm.haxx.se/docs/httpscripting.html

         http://curlm.haxx.se/libcurl/c/libcurl-tutorial.html

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-04-10