in reply to POST and POST
Perhaps the following code snippet will help you get going in the right direction. It needs a lot of error-checking (it's not intended to be a robust solution, just a starting point).
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use HTTP::Request; $/ = undef; #slurp; my $content = <STDIN>; my $uri = shift; # arg my $method = 'POST'; my $request = HTTP::Request->new($method, $uri, undef, $content); my $ua = LWP::UserAgent->new(timeout => 10); my $response = $ua->request($request); if ($response->is_success) { print $response->content; } else { print $response->error_as_HTML; }
|
|---|