I want to gather infos from the socket.
eg. I want get status code when I try to visit a website
I know how to connet web use IO::Socket,but how can I get the info from the socket connetction?
code is as below:
Code:
Code:
use IO::Socket;
$remote=IO::Socket::INET->new(
Proto=>'tcp',
PeerAddr=>"www.sina.com.cn",
PeerPort=>"80",
)
or die "can not reach that site";
while (<$remote>)
{print;
}
close $remote;