use Socket;
sub connect_host {
local *SOCK;
my $remote = gethostbyname("football.fantasysports.yahoo.com")
|| die("Error resolving host name: $!\n");
my $proto = getprotobyname('tcp');
my $port = 80;
my $remote_host = sockaddr_in($port, $remote);
socket(SOCK, PF_INET, SOCK_STREAM, $proto)
or die("Error creating socket: $!\n");
connect(SOCK, $remote_host)
or die("Error connecting to remote host: $!\n");
print SOCK "GET / HTTP/1.0\015\012\015\012";
flush(SOCK);
local $/; # Read until end of file (as opposed to end of line).
return scalar(<SOCK>);
}
sub flush { select($_[0]); my $t=$|; $|=1; $|=$t; }
my $page = connect_host();
print($page);
|