m3LLow has asked for the wisdom of the Perl Monks concerning the following question:
But how to do this using POST method including submission of serveral variables?use LWP::UserAgent; $ua = LWP::UserAgent->new; $URL = 'ftp://ftp.unit.no/pub/rfc/rfc-index.txt'; my $expected_length; my $bytes_received = 0; my $res = $ua->request(HTTP::Request->new(GET => $URL), sub { my($chunk, $res) = @_; $bytes_received += length($chunk); unless (defined $expected_length) { $expected_length = $res->content_length || 0; } if ($expected_length) { printf STDERR "%d%% - ", 100 * $bytes_received / $expected_length; } print STDERR "$bytes_received bytes received\n"; # XXX Should really do something with the chunk itself # print $chunk; }); print $res->status_line, "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using callback on the response for the POST method
by aersoy (Scribe) on Jul 18, 2002 at 21:28 UTC | |
by m3LLow (Acolyte) on Jul 18, 2002 at 21:41 UTC |