in reply to IO::Socket
That should be syntactically correct. I didn't use strict, I also didn't take into account whether the HTTP server did or did not respond, so that while(<$www>) would block forever. Also I didn't actually remove the HTML tags returned. All these reasons and a few more are why people are pointing you to modules as opposed to simply answering the question you asked.use IO::Socket; $www = IO::Socket::INET->new( PeerAddr => 'some_host_or_ip', PeerPort => '80_or_whatever_port_http_is_on', Proto => 'tcp', Type => SOCK_STREAM ) || die "Cant connect to some_host_or_ip\n$!\n"; print $www "GET / HTTP/1.0\n\n"; while (<$www>) { push(@response, $_); } close($www); print "Got Back\n"; for (@response) { print; }
|
|---|