cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

perl libcurl refuses to write cookie file

From: Maarten Dekker <maarten_at_datastorm.nl>
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
enabled)

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

Could anyone help me out?

Regards,

Maarten

use WWW::Curl::easy;

my $url = "http://www.careeredge.ca/sitemap.asp";

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
$curl->setopt(CURLOPT_FOLLOWLOCATION, 1);

# 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_COOKIEJAR,
cookies.txt);
$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";
};
$curl->curl_easy_cleanup();
#
# 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.
www.parasoft.com/bulletproofapps1
Received on 2003-07-12

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET