#!/usr/bin/perl -w
use strict;
use IO::Socket;
my $host = "www.naver.com";
my $header = "GET / HTTP/1.1
Host:www.naver.com\n\n";
my $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 "--------- HTTP REQUEST to $host --------\n";
print $header;
print "--------- HTTP RESPONSE from $host --------\n";
print $remote $header;
while ( <$remote> ) { print }
close $remote;
댓글 없음:
댓글 쓰기