#!/usr/local/bin/perl # Create a user agent object use LWP::UserAgent; $ua = new LWP::UserAgent; # $ua->agent("AgentName/0.1 " . $ua->agent); # Create a request my $req = new HTTP::Request GET => 'http://www.yahoo.com'; # my $req = new HTTP::Request POST => 'http://www.x-rates.com/htmlgraphs/esp30.html'; # $req->content_type('application/x-www-form-urlencoded'); # $req->content('match=www&errors=0'); # 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) { $content = $res->content; } else { print "Bad luck this time\n"; } print $content;