cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_FILE question

From: <Kenneth.Quan_at_wellsfargo.com>
Date: Wed, 17 Dec 2003 15:33:28 -0700

Using curl 7.10.5 (sparc-sun-solaris2.8)

Running a simple test code below, I get an error with Bad filehandle: at
./curl.pl line 7.
I basically mimicked the example show here:
http://search.cpan.org/~crisb/WWW-Curl-2.0/easy.pm.in
I mainly just want to capture output into a string to perform simple pattern
matching, so I basically don't want any tmp files floating around once
pattern matching is over.

Thanks

#!/usr/local/bin/perl
use WWW::Curl::easy;
$body = "";
my $curl = WWW::Curl::easy->new();
      $curl->setopt(CURLOPT_VERBOSE, TRUE);
      $curl->setopt(CURLOPT_URL, "http://yahoo.com");
      $curl->setopt(CURLOPT_FILE, \$body);
my $ret=$curl->perform();
print $body;
exit;

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-17