Ordig has asked for the wisdom of the Perl Monks concerning the following question:

Hey, There is a scenerio where : When i go to particular server and opened a browser, and when i type http:// server ip:portnumber/a=getstatus , then on the browser, i get an xml output. I need to capture that output. Why ?? The port is an ACI object port, and the status can be fetched by only this method. I created a script running for all other port, say 80, for a website, I am able to get that output but not for this port especially. Any help on this ?? Surely will give you Kudos for this :) Regards, Ordig

Replies are listed 'Best First'.
Re: Fetch output coming as an xml format
by GotToBTru (Prior) on Feb 17, 2015 at 21:00 UTC

    What do you have so far? What happens when you try to get the output using the method you know?

    Dum Spiro Spero
      use LWP; use LWP::UserAgent; $host = '16.183.90.81'; $port = '8004'; $uri = '/a=getstatus'; $http = 'http'; $lwp_user_agent = LWP::UserAgent->new; $lwp_user_agent->timeout($timeout); if ( $port == 80 || $port == 443 || $port eq "" ) { $lwp_user_agent->default_header('Host' => $host); } else { $lwp_user_agent->default_header('Host' => "$host:$port"); } $url = "$http://$host:${port}$uri"; $http_request = HTTP::Request->new(GET => $url); print "--------------- GET $url"; print $lwp_user_agent->default_headers->as_string . $http_request->hea +ders_as_string; $http_response = $lwp_user_agent->request($http_request); print "---------------\n" . $http_response->protocol . " " . $http_res +ponse->status_line; print $http_response->headers_as_string; print "Content has " . length($http_response->content) . " bytes \n"; if ($http_response->is_success) { $body = $http_response->content; print $body; }
      This above script when I use for particular site, running on my machine on port 8004, then I'm able to get the output accordingly. But, when I use this script on another machine, on port 20000, then I m not getting any output. Please see the link below for which ACI port i'm talking about and not getting any output for this case.
      https://www.novell.com/documentation/extend52/Docs/help/exteNd/books/e +xt521_Autonomy.html
      this is the same exact scenerio, there you can see, one has to open a browser and run - http://localhost:20000/a-getstatus . I too want to query the interface port through perl and see the output.
        Any Update ??