Hello everyone,
i just made a request with lwp::useragent and i was wondering if exept of the response, the host name and the ip, i can print also the port which the request is being to and which port the response is coming to.
as much as i searched the modules and the cpan i didn't find anything that i can understand.
Does anyone knows an easy way for solving my problem?
my $site = "
my $ua = LWP::UserAgent->new;
$ua->agent('MyApp/0.1');
my $request = HTTP::Request->new(GET => $site);
my $response = $ua->get($site,);
print $response->content,"\n";
my $ipsite = $site;
$ipsite =~ s/http:\/\///;
$ipsite =~ s/$ipsite =~ s/\/.*//;
my $addr = gethostbyname($ipsite);
if(not gethostbyname($ipsite)){
print "Hostname does NOT exist\n";
}
else {
print "Server Hostname: ",$ipsite,"\n";
printf "Hostname IP Address: %s \n", inet_ntoa($addr);
}
i just made a request with lwp::useragent and i was wondering if exept of the response, the host name and the ip, i can print also the port which the request is being to and which port the response is coming to.
as much as i searched the modules and the cpan i didn't find anything that i can understand.
Does anyone knows an easy way for solving my problem?
my $site = "
my $ua = LWP::UserAgent->new;
$ua->agent('MyApp/0.1');
my $request = HTTP::Request->new(GET => $site);
my $response = $ua->get($site,);
print $response->content,"\n";
my $ipsite = $site;
$ipsite =~ s/http:\/\///;
$ipsite =~ s/$ipsite =~ s/\/.*//;
my $addr = gethostbyname($ipsite);
if(not gethostbyname($ipsite)){
print "Hostname does NOT exist\n";
}
else {
print "Server Hostname: ",$ipsite,"\n";
printf "Hostname IP Address: %s \n", inet_ntoa($addr);
}