I want to post a form including id, password and other data to
a url with Perl/CGI.
I follow the example below:
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ua = LWP::UserAgent->new();
my $req = POST 'http://www.perl.com/cgi-bin/cpan_mod',
[ module => 'DB_File', readme => 1 ];
$content = $ua->request($req)->as_string;
But it doesn't work.
The reponse is: "HTTP/1.1 500 Internal Server Error"
Does anyone have any idea what is wrong with it.
Any help will be appricated.
Thanks for your time.
Mimi
Thank you for the reply.
The example code works fine for me as well. But after I put in my own fields, it stop working. If I type in the url and all the pass in fields(e.g. [myusrl?id=myid&password=mypassword&name1=myname1&address=myaddress),...] it will work.
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
$ua = LWP::UserAgent->new();
my $req = POST 'my url',
[ id => $id, password => $password, name1=>$name1, name2=>$name2, address = $address];
$content = $ua->request($req)->as_string;
The error log says that: "HTTP/1.1 500 Internal Server Error".
I believe that I've got all modules required otherwise the example code wouldn't work.
How could I find out what url are actually called and together with their parameters?
I used warn("$req"), but it print out: "HTTP::Request=HASH(0x8e350c0)".
Thanks again
Mimi
For example, you are posting to this URL: [myusrl?id=myid&password=mypassword&name1=myname1&address=myaddress...]
But instead you should be posint to just [myusrl...]
I don't think this could be a problem, but try it.
And what you showed here is not a log entry, this is what you see on the screen, but what does you error log file say?