Data access via the Web
# Create a user agent object use HTTP::Request::Common; use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->agent("AgentName/0.1 " . $ua->agent); # Create a request my $req = POST "http://www.gamelon.com/somedir/getinfo.cgi", [ lname => 'jones', id => '123' ]; # 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 "Bad luck this time\n"; }
Page 2 of 3
This article was originally published on May 25, 1999