Problem reading HTTP POST request using STDIN
- From: kishorekasina@xxxxxxxxx
- Date: 12 Jun 2006 23:12:55 -0700
Hi All,
Inorder to retrieve the query string for a HTTP post request, it was
mentioned in many websites and tutorial that instead of using
QUERY_STRING; STDIN should be used and i did the same thing as follows
(in a sample.pl and calling it from one.pl with form action = post):
if ($request_method eq "GET") {
$query_string = $ENV{'QUERY_STRING'};
} elsif($request_method eq "POST") {
print "Content Lenght is : ",$ENV{'CONTENT_LENGTH'},"<BR>";
read(STDIN, $query_string,$ENV{'CONTENT_LENGTH'})
|| die "Could not get query\n";
}
I even tried looping through the content_lenght using getc - but even
that is not working
Note: not putting the html code to display for simplicity
When call this code, it does print the content length as 32, but after
that it prints the die part of the code ie. "Could not get query"
message and throws Software error message.
I am running this script in Apache 2.2 on Windows 2000 professional
box.
What mistake I am doing, is it something to do with my environment ?
Am I missing somethign ?
Please help
with regards
Kishore
.
- Prev by Date: Re: Help understand documentation
- Next by Date: Re: subroutine?
- Previous by thread: Open Perl IDE not compiling
- Next by thread: Re: Using Net::SSH::Perl to execute a set of commands
- Index(es):
Relevant Pages
|
|