in reply to getting HTML source
use IO::Socket; my $host = "www.perlmonks.com"; my $port = 80; my $path = "/"; # The path is everything after the host name (includin +g the first /) # You need the two \n in the get request my $get =<<EOF; GET $path HTTP/1.0 EOF # Open our socket my $http_request = IO::Socket::INET->new( Proto => "tcp", PeerAddr => $host, PeerPort => $port, ) or die $!; # Write our request print $http_request $get; # Grab the output my @html = <$http_request>; # Do something with the output print @html;
|
|---|