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

Hi experts, I want to do one thing with Perl. I have two windows machines, one has perl installed, say machine A and other dont have perl, say Machine B. I want to go into the machine B first, and after it, i want to execute a command that will fetch the output of URL which is running on that server. The url is still something http://localhost:5678. That url is not reachable to Machine A How can i achieve this ?
  • Comment on Get into the server and execute perl command

Replies are listed 'Best First'.
Re: Get into the server and execute perl command
by Corion (Patriarch) on Feb 24, 2015 at 20:29 UTC

    The easiest way is to set up ssh port forwarding and run something like

    ssh -L 3456:localhost:5678 that.other.machine

    Then, your local port machineA:3456 will be connected to the (localhost) port 5678 on machineB, and you can just use LWP::Simple to fetch http://localhost_3456 and get data from http://localhost:5678 on machineB.

      ok, suppose, I get into the server, now how should i do to use LWP::Simple. Can you provide me a demo of this algo. Second, the output come from http://localhost:3456 is an " unformatted XML". and I'm wondering if the Machine B gives its result because Perl is not installed in it.

        I suggest that you read the documentation of LWP::Simple. I'm not sure what other things you would need. This is not a code writing service.

        Also, I do not understand what you mean by "unformatted XML", and how it would be problematic.

Re: Get into the server and execute perl command
by GotToBTru (Prior) on Feb 24, 2015 at 16:21 UTC
      I am making a spam bot. Thank you for helping.
Re: Get into the server and execute perl command
by karlgoethebier (Abbot) on Feb 25, 2015 at 13:23 UTC