|
(view this code in a separate window) #!/usr/bin/perl -w # # post.pl # # Make an HTTP POST request in a few lines of perl. # Why bother with a browser.... # # Copyright 2001, James Lee # Released under the GPL. use HTTP::Request::Common qw(POST); use LWP::UserAgent; $ua = LWP::UserAgent->new(); my $req = POST 'http://localhost/cgi-bin/example1.cgi', [ name => 'John', phone => '312.555.1212', data => 'bad data' ]; $content = $ua->request($req)->as_string; print $content;
|