Is there a perl module for posting to a page with cgi through a script? What I'm trying to do is fill out a form and submit it daily. Is there an easy way to do this?
: Is there a perl module for posting to a page with cgi through a script? What I'm trying to do is fill out a form and submit it daily. Is there an easy way to do this? :
LWP::UserAgent and Net::SSLeay
Both are pretty straightforward to use too.
Some example code for UserAgent is below:
my $ua = new LWP::UserAgent; my $req = new HTTP::Request 'POST','http://www.xxxxxxx.com/cgi-bin/xxxxx.pl'; my $query = "var1=value1&var2=value2"; #This must be a properly URL encoded string
$req->content_type('application/x-www-form-urlencoded'); $req->content($query); my $res = $ua->request($req);
$res->content will hold the content of the response. $res->is_error will be true or false depending on whether or not an error occured.
: : Is there a perl module for posting to a page with cgi through a script? What I'm trying to do is fill out a form and submit it daily. Is there an easy way to do this? : : : : : LWP::UserAgent : and : Net::SSLeay : : Both are pretty straightforward to use too. : : Some example code for UserAgent is below: : : my $ua = new LWP::UserAgent; : my $req = new HTTP::Request 'POST','http://www.xxxxxxx.com/cgi-bin/xxxxx.pl'; : my $query = "var1=value1&var2=value2"; #This must be a properly URL encoded string : : : $req->content_type('application/x-www-form-urlencoded'); : $req->content($query); : my $res = $ua->request($req); : : $res->content will hold the content of the response. : $res->is_error will be true or false depending on whether or not an error occured. : :
Comments
:
LWP::UserAgent
and
Net::SSLeay
Both are pretty straightforward to use too.
Some example code for UserAgent is below:
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request 'POST','http://www.xxxxxxx.com/cgi-bin/xxxxx.pl';
my $query = "var1=value1&var2=value2"; #This must be a properly URL encoded string
$req->content_type('application/x-www-form-urlencoded');
$req->content($query);
my $res = $ua->request($req);
$res->content will hold the content of the response.
$res->is_error will be true or false depending on whether or not an error occured.
: : Is there a perl module for posting to a page with cgi through a script? What I'm trying to do is fill out a form and submit it daily. Is there an easy way to do this?
: :
:
:
: LWP::UserAgent
: and
: Net::SSLeay
:
: Both are pretty straightforward to use too.
:
: Some example code for UserAgent is below:
:
: my $ua = new LWP::UserAgent;
: my $req = new HTTP::Request 'POST','http://www.xxxxxxx.com/cgi-bin/xxxxx.pl';
: my $query = "var1=value1&var2=value2"; #This must be a properly URL encoded string
:
:
: $req->content_type('application/x-www-form-urlencoded');
: $req->content($query);
: my $res = $ua->request($req);
:
: $res->content will hold the content of the response.
: $res->is_error will be true or false depending on whether or not an error occured.
:
: