In your original node you identified the problem as: One of the functions connects to a web page and parses the content
So it dosn't matter if you are an IRC bot, it is still trying to access a web server thru a socket, so you need to deal with the http protocols. This is the most basic ....notice you need to send a Get, or at least a "\n\n", before the web server will respond.
#!/usr/bin/perl -w # Usage: this_script 192.168.0.1 /~zentara/index.html use IO::Socket; unless (@ARGV > 1) { die "usage: $0 host document ..." } $host = shift(@ARGV); foreach $document ( @ARGV ) { $remote = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $host, PeerPort => "http(80)", ); unless ($remote) { die "cannot connect to http daemon on $host" } $remote->autoflush(1); print $remote "GET $document HTTP/1.0\n\n"; while ( <$remote> ) { print } close $remote; }
In reply to Re^3: Thread weirdness
by zentara
in thread Thread weirdness
by j0nny
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |