I'm sure I'll get some crap for this old snippy-quick coding, but
here is an example, if you are interested in HTTP 200, etc. codes
(this is cut and paste from a function, so no header, etc.), or for
more flexibility. I never got https to work, I think the firewall
is closed to 443.
use IO::Socket;
use Sys::Hostname;
my $ip = shift( @_ );
my $port = shift( @_ );
my $hostname = hostname();
my $retval = "";
my $protocol = "HTTP";
if ( $port == 443 )
{
$protocol = "HTTPS";
}
my @pages = @_;
foreach my $page ( @pages )
{
chomp( $page );
if ( $page !~ m#..# )
{
next;
}
my $remote = IO::Socket::INET->new ( Proto => "tcp",
PeerAddr => $ip,
PeerPort => "${protocol}($port)",
);
if ( ! $remote )
{
$retval .= ( "ERROR : $hostname : unable to create $protocol
socket to $ip\n\n" );
}
else
{
$remote->autoflush( 1 );
$page =~ s#\\#/#g;
if ( $page !~ m#^/# )
{
$page = "/${page}";
}
my $get = "GET $page ${protocol}/1.0\n\n";
print $remote "$get";
chomp( $get );
my $line = <$remote>;
my @rest = <$remote>;
# if ( $line !~ m#^HTTP.?/.* (200 OK|302 Object Moved)#i )
# if ( $line !~ m#HTTP.?/.* (200 OK|302 Object Moved)#i )
if ( $line =~ m#HTTP.?/.* (404 Object Not Found)#i )
{
$retval .= "ERROR : $protocol $get from $ip returns
${line}\n";
}
else
{
$retval .= "${protocol}://${ip}:${port}${page} :
$line\n";
}
close( $remote );
}
}
return( $retval );
At Wednesday, 30 January 2002, "Collins, Joe (EDSI\\BDR)" <JCollins2@exchange.
ml.com> wrote:
>For example, suppose I want to capture www.cnn.com into an array
>and process the text. How does one do this?
>
>Many thanks,
>
>Joe
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]