in reply to Re: Fetching HTML Pages with Sockets
in thread Fetching HTML Pages with Sockets

Unfortunately, when I tried to use LWP::UserAgent it was not included in @INC, and getting my sysadmin to install anything, well, won't happen.
When using the hex values, I get barked at for an invalid hex value.
amt

Replies are listed 'Best First'.
Re^3: Fetching HTML Pages with Sockets
by ikegami (Patriarch) on Sep 19, 2004 at 19:42 UTC
    odd, it works for me in perl 5.6.1 and 5.8.0 How about octal? "\015\012"
      The octal codes work, but the program still hangs. I have tested my HTTP statements by telnetting to the host and typing them in, the trouble I am having is with this darn socket.

      amt
        use Socket; use CGI; my $page = connect_host() or die "$!";; print "$page"; flush(SOCK); sub connect_host { my $remote = gethostbyname("football.fantasysports.yahoo.com") +; my $proto = getprotobyname('tcp'); my $port = 80; my $remote_host = sockaddr_in($port,$remote); socket(SOCK,PF_INET,SOCK_STREAM,$proto) or die "$!"; connect(SOCK, $remote_host); print SOCK "GET / HTTP/1.0\015\012\015\012"; my $html = <SOCK> if(defined(<SOCK>)) or die "$!"; return $html; } sub flush { select($_[0]); my $t=$|; $|=1; $|=$t; }
        New error message is Connection reset by peer at ./pcs.pl line 29.
        amt