Problem reading HTTP POST request using STDIN



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

.



Relevant Pages

  • Re: Decoding the query string array
    ... of my head and may require some work on your part:) ... //Give me my result or die, ... > the database that matches the name from the query string. ... > I have tried this but for some reason I cannot get a number back from ...
    (comp.lang.php)
  • Re: VB6 cgi hangs with 4KB HTTP query string in server 2003 and IIS6
    ... Don't ask why they are in VB6 - the ... We have a query string that ends up being 4000 bytes long ... Need to know a bit more about that stdin. ... reduce or expand that limit. ...
    (microsoft.public.vb.general.discussion)