Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Using WWW::Curl::Easy with Perl
- Alex Buell
July 21, 2008, 1:21 pm
rate this thread
Does anyone in here have a good working knowledge of using the
WWW::Curl::Easy module with Perl? Basically, my problem is that I have
been trying to download a file using the WWW::Curl::Easy module without
any success, in a Perl cgi-bin.
For some reason, it is not putting the requested data into a file,
instead I get it printed on the page itself.
Any ideas why?
my $cgi = new CGI;
my $file = "temp/" . $$ . "sitemap.gz";
my $url = "http://www.talkcycling.co.uk/sitemap_index.xml.gz ";
my $curl = WWW::Curl::Easy->new;
print $cgi->p("[" . $url . "][" . $file . "]");
open SITEMAP, "> $file";
my $return_code = $curl->perform;
my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE);
print $cgi->p("DEBUG [" . $response_code . "][" . $return_code . "]");
if ($response_code <= 400 && $return_code == 0)
Re: Using WWW::Curl::Easy with Perl
What other language would you use a Perl module? :-)
> Basically, my problem is that I have
No such thing as "a Perl cgi-bin". :-)
Never used it before, it's only a couple lines when using LWP, but...
I'd guess that's the problem. Comment out that last line. Don't
set CURLOPT_WRITEDATA to 0.
And if open() fails?
- » FAQ 2.17 What is perl.com? Perl Mongers? pm.org? perl.org? cpan.org?
- — Previous thread in » PERL Discussions