NTS Forums

Please login or register.

Login with username, password and session length
 

News:

Welcome to the Newtek Technology Services Forum!


Author Topic: Problem using Http::Request::Form  (Read 4698 times)

Offline varuna1

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Problem using Http::Request::Form
« on: November 08, 2005, 04:17:07 PM »
Hi Everyone

I am using the perl script but at the time of calling of this script it gives error at http::request::form.
Please if anyone could help me

Thanks.

=====================================
#!/usr/bin/perl -w

use strict;
use URI::URL;
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Request::Common;
use HTTP::Request::Form;
use HTTP::Cookies;
use HTML::TreeBuilder 3.0;
use DBI;

my ($db_table, $db_user, $db_pass) = ("tab", "dbu", "pass");


my $url = "https://abc.def";

my $ua = new LWP::UserAgent;
push @{ $ua->requests_redirectable }, 'POST';
$ua->cookie_jar(new HTTP::Cookies(file => "./cookies.txt"));

my $req = new HTTP::Request(GET $url);
my $res = $ua->request($req);


my $tree = new HTML::TreeBuilder;
$tree->parse($res->content);
$tree->eof();

my @forms = $tree->find_by_tag_name('FORM');
if(!@forms) {
   die "No forms found";
}

my $form = new HTTP::Request::Form($forms[0], $url);
$form->field("{actionForm.username}", "user");
$form->field("{actionForm.password}", "password");

$res = $ua->request($form->press());

Offline Jon E

  • Hero Member
  • *****
  • Posts: 1,445
  • Karma: +20/-16
    • http://www.crystaltech.com
Problem using Http::Request::Form
« Reply #1 on: November 08, 2005, 04:22:22 PM »
Is the module installed?  Is it working properly outside of your script?

Thanks,
Jon Ernster
CrystalTech Web Hosting, Inc.
Server Operations Administrator

Offline varuna1

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Problem using Http::Request::Form
« Reply #2 on: November 08, 2005, 04:25:05 PM »
Yes it is installed properly.

Offline varuna1

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Problem using Http::Request::Form
« Reply #3 on: November 09, 2005, 10:37:11 AM »
This is the error we are getting when we run the script manually.
Can anyone suggest anything now?
================================================

Can't locate HTTP/Request/Form.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i
386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-
linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/
lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5
.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /us
r/lib/perl5/5.8.0 .) at fetch.pl line 8.
BEGIN failed--compilation aborted at fetch.pl line 8.