in reply to Curl and Perl
#!/usr/bin/perl use strict; use warnings; use WWW::Curl; use WWW::Curl::Easy; { my $curl = WWW::Curl::Easy->new(); my $fh = 'README'; if( $curl ){ $curl->setopt(CURLOPT_HEADER,1); $curl->setopt(CURLOPT_URL, 'ftp://ftp.perl.org/pub/CPAN/README'); my $response_body; open(my $fh, '>', \$response_body); $curl->setopt(CURLOPT_WRITEDATA, $fh); $curl->setopt(CURLOPT_VERBOSE,1); my $retcode = $curl->perform(); if ($retcode != 0) { warn "An error happened: ", $curl->strerror($retcode), " ( +$retcode)\n"; warn "errbuf: ", $curl->errbuf; } $curl->curl_easy_cleanup; } else { warn " WWW::Curl::Easy->new() failed"; } } exit 0;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Curl and Perl
by sai.dasika (Initiate) on Jun 23, 2010 at 13:19 UTC | |
by Corion (Patriarch) on Jun 23, 2010 at 13:23 UTC | |
by sai.dasika (Initiate) on Jun 23, 2010 at 18:08 UTC | |
by Corion (Patriarch) on Jun 23, 2010 at 18:14 UTC | |
by Anonymous Monk on Feb 21, 2020 at 14:17 UTC |