Perl LWP::UserAgent get no answer -
Perl LWP::UserAgent get no answer -
i'm sending post request http server , got no answer. code is
my $req = http::request->new(post => $url); $req->content_type('application/html'); $req->content($text); $response = $browser->request($req);
and application hangs in request till timeout. server, standalone application, sending reply script didn't receive it. server receive data. thought root cause? how more details if received, discarded, etc. wrong formatting, etc.?
full code added:
#!/usr/bin/perl -w utilize strict; utilize lwp; utilize http::request::common; $browser = lwp::useragent->new( ); $browser->env_proxy( ); # if we're behind firewall $path =$argv[0]; #'file send'; $url = $argv[1]; #'http://127.0.0.1:9000'; open (myfile, $path) or die "can't open $path\n"; $text = { local $/; <myfile> }; close (myfile) or die "can't close $path\n";; $req = http::request->new(post => $url); $req->content_type('application/html'); $req->content($text); $response = $browser->request($req); if ($response->is_success) { print $response->content; } else { print $response->message; };
perl lwp-useragent http-request
Comments
Post a Comment