PDA

View Full Version : how to simulate form post using perl


MetalGear
07-24-2008, 09:09 AM
hello all
I am trying to form post using perl
below is the code..
but it is not working..
plz help me..
thank you

use HTTP::Request::Common
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
my $req = (post 'http://192.168.1.1/goform/ifx_set_system_reset',["factory" => "1"]);
$request = $ua->request($req);
$content = $request->content;

MetalGear
07-24-2008, 11:29 AM
hi all

i got it
the below code works fine

thanks all
[code]

use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
my $req = (POST 'http://192.168.1.1/goform/ifx_set_system_reset', ["factory" => "1"]);
$response_to_discard = $ua->request($req);
print "Location: http://http://192.168.1.1/system_reset.htm\n\n";
exit;