coolsaurabh has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to execute one URL from the CGI script but failing to do.Any inputs are highly welcome.Please find below the two codes used for the same.
use CGI ':standard'; use HTTP::Request; use LWP::Simple qw/get/; $url = 'https://10.204.16.17:16316/ibm/console/login.do?action=secure' +; `wget $url`;
#!/usr/bin/perl use LWP::UserAgent ; use HTTP::Request ; my $URL = 'https://10.204.16.17:16316/ibm/console/login.do?action=secu +re'; my $agent = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1, timeou +t => 30); my $header = HTTP::Request->new(GET => $URL); my $request = HTTP::Request->new('GET', $URL, $header); my $response = $agent->request($request); # Check the outcome of the response if ($response->is_success){ print "URL:$URL\nHeaders:\n"; print $response->headers_as_string; print "\nContent:\n"; print $response->as_string; }elsif ($response->is_error){ print "Error:$URL\n"; print $response->error_as_HTML; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Unable to execute URL from perl/cgi script
by Anonymous Monk on Feb 05, 2015 at 19:59 UTC | |
by coolsaurabh (Acolyte) on Feb 06, 2015 at 06:28 UTC | |
by Anonymous Monk on Feb 06, 2015 at 21:40 UTC |