Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

500 Can\'t connect to xml.reuniontelecom.com:80 (Bad hostname \'xml.reuniontelecom.com\')

Posted on 2007-12-03
6
1,039 Views
Last Modified: 2010-03-24
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><ClientID>2070</ClientID><NPA>561</NPA></Request>';

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_content);
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.

0
Comment
Question by:Aloha_Technology
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 20396425
Can you get to that site when using a web browser from the same machine?
0
 

Author Comment

by:Aloha_Technology
ID: 20401195

Hi ,
Your doubt is correct but it opens with the browseron the same machine.


Thanks.
0
 
LVL 39

Expert Comment

by:Adam314
ID: 20406835
Try this....

unless ($host_response->is_success) {
    die "Could not connect to '$uri': " . $host_response->status_line . "\n";
}

What is the output?
0
 

Author Comment

by:Aloha_Technology
ID: 20425970

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=============>500 Can't connect to xml.reuniontelecom.com:80 (Bad hostname 'xml.reuniontelecom.com')

What can be the problem.

Please advice.
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 250 total points
ID: 20442941
Try this script.... what do you get:


use LWP::Simple;
my $uri = 'http://xml.reuniontelecom.com/';
$content = get($uri);
die "Couldn't get it!" unless defined $content;
 
print "Got content:\n$content\n";

Open in new window

0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Can I exclude specific directory with icacle command? 3 57
parse a file and get data out 11 77
Need to combine two scripts 2 33
Debug script powershell wmi 3 15
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question