Hey perlers,
I have this bit of cgi code that is not working any more (I am sure it
did at one time, but I must have modified it wrong) and I need to
resurrect it.
What I am trying to accomplish is to check the Wan address of a
NetGear broadband router. The method I am trying to use is to telnet
to port 80, then do a 'GET / HTTP/1.0'.
telnet localhost 80 <-- gets a blank screen
GET / HTTP/1.0 <-- follow this with \n\n
This is what I get:
HTTP/1.0 200 OK
Server: TinyWeb/1.9
Content-Length: 382
Content-Type: text/html
<html> <head> <title>Tim's ThinkPad</title> </head>
====8<---------------- sniped for brevity <g>
Here is my perl code in it's entirity...
<code>
#!perl -w
use strict;
use IO::Socket;
my (%FORM, $HeaderLine, $remote, $debug);
$FORM{Method} = "GET";
$FORM{Page} = "";
$FORM{HTTPv} = "1.0";
print "$FORM{Method} /$FORM{Page} HTTP/$FORM{HTTPv}\n";
$remote = IO::Socket::INET->new(
Proto => "tcp",
PeerAddr => "localhost",
PeerPort => "http(80)"
);
unless ($remote) { die "cannot connect to http daemon on $FORM{TelnetHost}" }
$remote->autoflush(1); # I think I read today that I don't need this any more
print $remote "$FORM{Method} /$FORM{Page} HTTP/$FORM{HTTPv}\n\n";
### The next line is where I think I am having problems...
### If I uncomment, I seem to recall it displaying the html code from
### above (HTTP/1.0 200 OK, etc...). But what happens is it just hangs.
# while ( <$remote> ) { print; }
print $remote;
close $remote;
</code>
Any suggestions are most welcome...
Thanks!
--
[EMAIL PROTECTED]
Using The Bat! eMail v1.61
Windows 2000 5.0.2195 (Service Pack 2)
What are you doing?!? The message is over, GO AWAY!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]