perl -MWWW::Curl::Lite -e 'print WWW::Curl::Lite->get("http://files.oo +ok.de")'
#!/usr/bin/perl -w use strict; use WWW::Curl::Lite; use WWW::Curl::Lite::Request; my $request = new WWW::Curl::Lite::Request({ url => 'http://oook.de' } +); $request->useragent('curltest/0.1'); $request->postfields('test=1&curl=cool'); my $curl = new WWW::Curl::Lite; my $response = $curl->request($request); print $response->content;
#!/usr/bin/perl -w use strict; use WWW::Curl::Lite; use WWW::Curl::Lite::Request; my $request1 = new WWW::Curl::Lite::Request; $request1->url('http://oook.de'); my $request2 = new WWW::Curl::Lite::Request; $request2->url('http://files.oook.de'); my $curl = new WWW::Curl::Lite; $curl->register($request1); $curl->register($request2); my $responses = $curl->request; foreach my $response (@$responses) { print $response->content; }
Yes, thats very similar to libcurls C API, but pure horror for most Perl hackers. :)#!/usr/bin/perl -w use strict; use WWW::Curl::Easy; my $url = 'http://oook.de'; sub header_callback { my $chunk = shift; print($chunk); return length($chunk); } + sub body_callback { my ( $chunk, $handle ) = @_; print($chunk); return length($chunk); } my $curl = new WWW::Curl::Easy; $curl->setopt( CURLOPT_URL, $url ); $curl->setopt( CURLOPT_HEADERFUNCTION, \&header_callback ); $curl->setopt( CURLOPT_WRITEFUNCTION, \&body_callback ); $curl->perform;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: First impressions of WWW::Curl::Lite
by Corion (Patriarch) on Feb 16, 2004 at 07:04 UTC | |
|
Re: First impressions of WWW::Curl::Lite
by Abigail-II (Bishop) on Feb 16, 2004 at 08:37 UTC | |
by sri (Vicar) on Feb 16, 2004 at 11:45 UTC | |
by ajt (Prior) on Feb 16, 2004 at 12:01 UTC | |
by sri (Vicar) on Feb 17, 2004 at 00:00 UTC | |
by Juerd (Abbot) on Feb 24, 2004 at 18:49 UTC | |
| |
by Aristotle (Chancellor) on Feb 16, 2004 at 21:55 UTC | |
by sri (Vicar) on Feb 16, 2004 at 22:53 UTC |