#!/usr/bin/perl #perl2exe_include HTTP::Request::Common #perl2exe_include LWP::UserAgent # Script to emulate a browser for posting to a # CGI program with method="POST". # Specify the URL of the page to post to. # my $URLtoPostTo = "http://flowto.info/cgi-bin/Dump.cgi"; my $URLtoPostTo = "https://10.10.10.10:5445/cgi-bin/lon.cgi"; # Specify the information to post, the form field name on # the left of the => symbol and the value on the right. my %Fields = ( "name" => "nivend", "test" => "testdata", "ip" => "10.10.10.171" ); # As seen above, "@" must be escaped when quoted. # If you want to specify a browser name, # do so between the quotation marks. # Otherwise, nothing between the quotes. my $BrowserName = "This Be Mine"; # It's a good habit to always use the strict module. use strict; # Modules with routines for making the browser. use LWP::UserAgent; #Next Module does the post request use HTTP::Request::Common; # Create the browser that will post the information. my $Browser = new LWP::UserAgent; # Insert the browser name, if specified. if($BrowserName) { $Browser->agent($BrowserName); } # Post the information to the CGI program. my $Page = $Browser->request(POST $URLtoPostTo,\%Fields); # Print the returned page (or an error message). print "Content-type: text/html\n\n\n"; if ($Page->is_success) { print $Page->content; } else { print $Page->message; } # end of script