Following was fetched using POST method and script name parameter
HTTP/1.1 200 OK
Connection: close
Date: Thu, 22 May 2008 17:52:19 GMT
Server: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7a DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a
Content-Type: text/html; charset=ISO-8859-1
Client-Date: Thu, 22 May 2008 17:52:19 GMT
Client-Peer: 64.62.154.102:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
You entered: "passme"
Following was fetched with GET using script name parameter
get_post.cgi
1 #!/usr/bin/perl
2 #%% Fetch URL with GET or POST method using parameters | WWW | HTTP::Request, LWP::UserAgent, LWP::Simple
3 #________________________________________________________________________________________________________
4
5 use HTTP::Request::Common qw(POST);
6 use LWP::UserAgent;
7 print "content-type: text/html\n\n";
8
9 $ua = new LWP::UserAgent;
10
11 # Initialize Post parameters
12 $myparams{"password"} = "passme";
13
14 #Create request
15 my $req = POST 'http://www.perlnow.com/cgi-bin/cgipassword.cgi', \%myparams;
16
17 # Retrieve the page
18 $page = $ua->request($req)->as_string;
19
20 print " Following was fetched using POST method and script name parameter
";
21 print "$page";
22
23 # GET:
24 use LWP::Simple;
25 $page = get("http://www.perlnow.com/cgi-bin/l.CGI?file=get_post.cgi");
26 print "Following was fetched with GET using script name parameter
";
27 print $page;