in reply to Get to non-port 80
Works verbatim.#!/usr/bin/perl use strict; use LWP::Simple; my $url ='http://www.wsu.edu:8080/~brians/errors/errors.html'; my $content = get $url; print $content;
I've never seen "get $url" construct before.. but I'm not a big LWP user. :) Stolen from the LWP perldoc, minus the url... (perldoc is your friend)
This script works for me.#!/usr/bin/perl use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->agent("MyApp/0.1 "); # Create a request my $req = HTTP::Request->new(GET => 'http://www.wsu.edu:8080/~brians/e +rrors/errors.html'); # Pass request to the user agent and get a response back my $res = $ua->request($req); # Check the outcome of the response if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; }
|
|---|