cURL / Mailing Lists / curl-library / Single Mail


perl libcurl refuses to write cookie file

From: Maarten Dekker <>
Date: Sat, 12 Jul 2003 15:35:56 +0200

Hi all,

Libcurl won't write cookies to a cookie file!
What am I doing wrong here?
The perl script is below.
libcurl version: Testing curl version libcurl 7.8 (OpenSSL 0.9.6b) (ipv6

I have also created a file manually(touch cookies.txt) this also did not help.

Could anyone help me out?



use WWW::Curl::easy;

my $url = "";

print "Testing curl version ",WWW::Curl::easy::version(),"\n";

# Init the curl session
my $curl= WWW::Curl::easy->new() or die "curl init failed!\n";

# Follow location headers

# Add some additional headers to the http-request:
my @myheaders=(
     "I-am-a-silly-programmer: yes indeed you are",
     "User-Agent: Perl interface for libcURL"

$curl->setopt(CURLOPT_HTTPHEADER, \@myheaders);
$curl->setopt(CURLOPT_URL, $url);

sub body_callback {
     my ($chunk,$context)=@_;
     push @{$context}, $chunk;
     return length($chunk); # OK

$curl->setopt(CURLOPT_WRITEFUNCTION, \&body_callback);

my @body;
$curl->setopt(CURLOPT_FILE, \@body);

if ($curl->perform() != 0) {
     print "Failed ::".$curl->errbuf."\n";
# Cleanup is automatic
#print join("",@body);

This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
Received on 2003-07-12