Here is one, which is easy to understand. (I didn't write it, but it works fine).
#!/usr/bin/perl
# Very simple client program to search for
# regular expressions on specified Web sites.
#
require 5.002;
use strict;
use Socket;
# Perl 5 technique for declaring local variables.
my ( $host, $in_addr, $proto, $port, $addr );
my ( $response, $page, $file, $pattern, %urls );
# Set up some URLs and patterns in an array hash
my @pages = ( "zentara.net/~zentara/poems.html", "zentara.net" );
foreach $page (@pages) {
( $host, $file ) = split /\//, $page, 2;
# Form the HTTP server address from the host
# name and port number
$in_addr = ( gethostbyname($host) )[4];
$port = 80;
$addr = sockaddr_in( $port, $in_addr );
$proto = getprotobyname('tcp');
# Create an Internet protocol socket.
socket( S, AF_INET, SOCK_STREAM, $proto )
or die "socket:$!";
# Connect our socket to the server socket.
connect( S, $addr )
or die "connect:$!";
# For fflush on socket file handle after every
# write.
select(S);
$| = 1;
select(STDOUT);
# Send get request to server.
print S "GET /$file HTTP/1.0\n\n";
print "===================$page===========================\n";
# Look for patterns in returned HTML.
while (<S>) {
foreach $page (@pages) {
print;
}
}
close(S);
}
exit;
I'm not really a human, but I play one on earth.
flash japh