I can put a URL in the address bar and get the desired result, but when I
post using LWP, the cgi program I am posting to is telling me that a
required parameter ('message') is missing.  This is the only required
parameter, so I assume the program is not receiveing any of the parameters.

I have tried the following in my code:

======================
my $ua = LWP::UserAgent->new;
$regional_library="test";
my $req = new HTTP::Request 'POST','http://domain.com/cgi-bin/cgiprogram';
$req->content_type('application/x-www-form-urlencoded');
$req->content('test=yes&custid=JP%40mail.davidson.alumlink.com&customer=Jame
s&message=Test+please+reply&pemail=test&subject=TestOfGsAnswers&GradeLevel=D
oYouSeeThis');

$req->content('query=libwww-perl&mode=dist');
my $res = $ua->request($req);

if ($res->is_success) {
   print $res->content;
} else {
   print $res->status_line, "\n";
}
===============

I am getting feedback from the last line print $res->status_line from the
cgi I am calling, saying that the one required parameter 'message' is
missing.  When I put this in the code to debug,

print $req->as_string;

I get this:

POST http://domain.com/cgi-bin/cgiprogram Content-Type:
application/x-www-form-urlencoded
test=yes&custid=JP%40mail.davidson.alumlink.com&customer=James&message=Test+
please+reply&pemail=test&subject=TestOfGsAnswers&GradeLevel=DoYouSeeThis

If I put the same information in the browser address bar as the
url.'?'.content, I get the desired result from the cgi:

http://domain.com/cgi-bin/cgiprogram?test=yes&custid=JP%40mail.davidson.alumlink.com&customer=James&message=Test+please+reply&pemail=test&subject=TestOfGsAnswers&GradeLevel=DoYouSeeThis

Thanks, James

Reply via email to