[WEB4LIB] CGI Script Question
TMGB
bennettt at am.appstate.edu
Fri Jan 29 16:44:52 EST 1999
Using PERL the example shows the following:
Client-Side Sockets
use IO::Socket;
$sock = new IO::Socket::INET (PeerAddr => 'www.ora.com',
PeerPort => 80,
Proto => 'tcp');
die "$!" unless $sock;
Server-Side Sockets
use IO::Socket;
$sock = new IO::Socket::INET (LocalAddr => 'maude.ora.com',
LocalPort => 8888,
Proto => 'tcp',
Listen =>5);
The client side example attempts to connect to PeerAddr over PeerPort using tcp.
The server side example provides a wrapper for creating the server socket. The
parameters for the new socket object determine whether it is a server or client
socket. Local provides the address and port to bind to the socket. The Listen can
wait for an accept. When the server receives a client request, it calls the accept
methon on the socket object.
This creates a new socket on which the rest of the communication can take place:
$new_sock = $sock->accept():
When communication is finished on both client and server sockets, they should be
destroyed with "close" other wise the socket will remain in use.
The command "send" writes data to a file handle so you could probably do something
like add in the line:
$logonauth = "###-###-###";
$authpass = "XXXX";
send($sock, $logonauth);
send ($sock, $authpass);
I don't know if that will work but you may want to try it. This is from a short
section in PERL IN A NUTSHELL book (about 10 pages) on sockets. If you haven't used
perl with forms there are some very basic examples at
http://intelnt.library.appstate.edu/cs3490/
I know this is not a complete answer but maybe it well help with direction.
Thomas
Andrew Mutch wrote:
> Here's a question for any of the CGI Pro's out there. Is there a way to create
> a CGI script that will submit several variables -- in this case a password and
> authorization -- to a specified URL?
>
> I know how to do this with Javascript -- the following code demonstrates that --
> the Javascript command 'onLoad' submits the values of the form 'oclc' to the URL
> specified in the ACTION variable. This example allows an automatic log-in to
> OCLC FirstSearch Usage Statistics.
>
> <body onLoad="document.oclc.submit()">
> <FORM
> NAME="oclc"
> METHOD=post
> ACTION="http://www.stats.oclc.org/cgi-bin/db2www/simoclc0.d2w/report">
> <INPUT SIZE=12 TYPE=HIDDEN NAME="logonauth" VALUE="###-###-###">
> <INPUT SIZE=12 TYPE=HIDDEN NAME="authpass" VALUE="XXXX">
>
> However, this method leaves your password, etc. out in the open for any one
> determined enough to get at it. I would like to be able to hide this
> information in a script that can be hidden away in out CGI-BIN directory. Is
> this doable??
>
> Thanks for the help!
>
> Andrew Mutch
> Library Systems Technician
> Waterford Township Public Library
> Charter Township of Waterford, MI
More information about the Web4lib
mailing list