Aloha_Technology
asked on
500 Can\'t connect to xml.reuniontelecom.com:80 (Bad hostname \'xml.reuniontelecom.com\')
HI all,
I m running the following script on the red ha linux in perl.
use strict;
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Headers;
use LWP::Debug qw(+);
my $method = 'POST';
my $uri = 'http://xml.reuniontelecom.com/';
#my $uri = 'http://www.google.com';
## This is the fake request we are generating
my $xmlRequest = '<?xml version="1.0" encoding="UTF-8"?><Request ><NXX>882< /NXX><Clie ntID>2070< /ClientID> <NPA>561</ NPA></Requ est>';
my $MIME_Version = '1.1';
my $content_type = 'text/xml';
my $content_length = length($xmlRequest);
my $content_transfer_encoding = 'text/xml';
my $document_type = 'Request';
my $header = HTTP::Headers->new;
$header->header (
'Content-Type' => $content_type,
);
my $HTTP_req = HTTP::Request->new($method,$uri) ;
my $UserAgent = LWP::UserAgent->new();
my $host_response = $UserAgent->get($uri);
unless($host_response->is_ success)
{
print STDERR "\n I M GETING ERRORS " x 10 ;
}
my $response_content = $host_response->content;
my @lines = split('\n',$response_conte nt);
my $ending_value = scalar(@lines);
print STDERR "\n========= response content ======== \n" . Dumper($response_content);
__END__
But I m getting the error as 500 Can\'t connect to xml.reuniontelecom.com:80 (Bad hostname \'xml.reuniontelecom.com\' )
I m unable to find where should investigate to get the proper response or elsewhat I m missing in the setting of my machine.
Kindly provoide the solutions.
Regards.
I m running the following script on the red ha linux in perl.
use strict;
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Headers;
use LWP::Debug qw(+);
my $method = 'POST';
my $uri = 'http://xml.reuniontelecom.com/';
#my $uri = 'http://www.google.com';
## This is the fake request we are generating
my $xmlRequest = '<?xml version="1.0" encoding="UTF-8"?><Request
my $MIME_Version = '1.1';
my $content_type = 'text/xml';
my $content_length = length($xmlRequest);
my $content_transfer_encoding
my $document_type = 'Request';
my $header = HTTP::Headers->new;
$header->header (
'Content-Type' => $content_type,
);
my $HTTP_req = HTTP::Request->new($method,$uri) ;
my $UserAgent = LWP::UserAgent->new();
my $host_response = $UserAgent->get($uri);
unless($host_response->is_
{
print STDERR "\n I M GETING ERRORS " x 10 ;
}
my $response_content = $host_response->content;
my @lines = split('\n',$response_conte
my $ending_value = scalar(@lines);
print STDERR "\n========= response content ======== \n" . Dumper($response_content);
__END__
But I m getting the error as 500 Can\'t connect to xml.reuniontelecom.com:80 (Bad hostname \'xml.reuniontelecom.com\'
I m unable to find where should investigate to get the proper response or elsewhat I m missing in the setting of my machine.
Kindly provoide the solutions.
Regards.
Can you get to that site when using a web browser from the same machine?
ASKER
Hi ,
Your doubt is correct but it opens with the browseron the same machine.
Thanks.
Try this....
unless ($host_response->is_succes s) {
die "Could not connect to '$uri': " . $host_response->status_lin e . "\n";
}
What is the output?
unless ($host_response->is_succes
die "Could not connect to '$uri': " . $host_response->status_lin
}
What is the output?
ASKER
Reunion people are saying that when you will send the request in the POST method you will get the proper response as thier server will behave as webservice . We are sending the same request as suggested by them Still the problem persists with the following output ,
host_response->status_line
What can be the problem.
Please advice.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.