in reply to Re: Re: Connecting to a remote host
in thread Connecting to a remote host

You should be able to call script2.pl like: http://mysite.com/cgi-bin/script2.pl?sent=Hello+World by typing that into the browser Address bar, and it should print something like Got sent = 'Hello World' Can't remember what format I had it printing but it was something like that. Once it works ie shows you what you sent it in the query string it will do the same when you call it using LWP::Simple get() method with the same URL. You can then just get it to print 'OK' which you then get back in $res:

use LWP::Simple; my $res = get( 'http://mysite.com/cgi-bin/script2.pl?sent=Hello+World' + ); if ( $res eq 'OK' ) { # blah }

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Re: Re: Connecting to a remote host
by rupesh (Hermit) on Apr 07, 2003 at 11:15 UTC
    Hi,
    Thanks again...
    but, the fact is this: i have a couple of servers at another place. I have a set of perl scripts each copied into these servers and one has to run it in the CMD to execute.

    What i want is, instead of waiting for someone to explicitly execute it one those servers( 8 of 'em), would like to exececute it from here using a socket - server, client method.
    These are the inputs required :
    machine name, location of script.
    and the script has to do the following:
    get some inputs from the user, and pass these inputs to a script on the server.

    The script on the server, works on these inputs in the database on that server, and populates a .csv file.
    I can later copy that .csv file and generate reports.
    All these functions are done via the command line. All my perl scripts are converted to exe using perl2exe, so that perl need not be installed in the server.

    So shortly, double click on script1, enter data, the data is sent to script2 in some server somewhere, after sometime a text file is created on that server. Is this possible?...... THanks a ton......

      Of course it is possible. There are any number of ways as detailed in the original node answers from me and Abigail-II

      Presumably you have Win32 boxes so most of the standard Linux tools won't be easily available. Making a simple socket server and clients is fairly easy for trivial cases in Perl. Why not do a Super Search for 'client server socket' or see merlyns columns on this. You will be using IO::Socket::INET in all liklihood. As noted you could use RPC, ssh or a number of other widgets as well.

      If you pull your finger out and write some code you will find the monks more than willing to help with your problems with getting that working. We all generally work for a living. People give us specs like the one above, we write the code, and they pay for it. We tend to help people (for free) who help themselves and demonstrate interest in Perl and effort in trying to code it.

      Just so you know you can do what you want in under 100 lines of combined code for the clients+server. If you want a quote no worries. If you want help with your code then 1) write some and 2) post it.

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print