in reply to user and pass in IO socket

You don't say why you "can not use LWP", but if you're going to purposely cripple yourself then you need to at least be reading the correct documentation as (IO::)Socket is only a small part of the picture.

To fill in the rest, you need to read RFCs 2617, 2616, and perhaps even 1945.

    --k.


Replies are listed 'Best First'.
(answer)Re:user and pass in IO socket
by e_macks (Novice) on Dec 05, 2001 at 09:45 UTC
    Thanks for the pointer Kanji, I eventually figured out that my request needed a line like:
    Authorization: Basic foobar

    For the posterity of future monks, my final code looks like this:


    snip
    my $userPass = base64("user:password"); # Need two \n in the get request my $get =<<EOF; GET $path HTTP/1.0 Authorization: Basic $userPass EOF # Open the socket my $http_request = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $host, PeerPort => $port, ) or return $!; print $http_request $get; # Write the request my $webPage; { # Grab the output local($/) = undef; $webPage = <$http_request>; } return $webPage;

    snip