I am using LWP::UserAgent to check the response from a server. I get a response from port 443 but I am not able to get any response from port 8443.
When I use cURL for Windows I get a response code from both ports.
Please help me.
I am using LWP::UserAgent to check the response from a server. I get a response from port 443 but I am not able to get any response from port 8443.
When I use cURL for Windows I get a response code from both ports.
Please help me.
This example program (adapted from perldoc lwpcook) shows how to connect with a different port
It also allows turning off of the SSL verify, in case you have a home brew cert that is causing a problem
#!/usr/bin/perl
$port = $ARGV[1] || 443;
$host = $ARGV[0] || 'pause.perl.org';
$verify =$ARGV[2] || 0;
use LWP::UserAgent;
$ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => $verify});;
#$ua->agent("$0/0.1 " . $ua->agent);
$ua->agent("Mozilla/8.0"); # pretend we are very capable browser
$req = HTTP::Request->new( GET => "https://$host:$port" );
$req->header( 'Accept' => 'text/html' );
# send request
$res = $ua->request($req);
# check the outcome
if ( $res->is_success ) {
print $res->decoded_content;
}
else {
print "Error: " . $res->status_line . "\n";
}