Home > Archive > PERL CGI Beginners > August 2005 > Correct Way to read POST data
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Correct Way to read POST data
|
|
| Shawn Devlin 2005-08-10, 3:59 am |
| Hello,
I need to read the, for lack of a better term, raw post data sent to a
CGI script. I have the following code:
use CGI;
my $Cgi = CGI->new();
my $PostData = $Cgi->query_string;
Is this the correct/best way?
The reason I ask is that, for one user calling my script, the $PostData
contents have the string ';keywords=' in place of any space character.
For example, if the user was calling my script and passing 'hello
world', $PostData would contain 'hello;keywords=world'.
Thanks,
Shawn
| |
| Zentara 2005-08-10, 10:00 pm |
| On Wed, 10 Aug 2005 00:31:02 -0400, linux@secludedgrove.com (Shawn
Devlin) wrote:
>I need to read the, for lack of a better term, raw post data sent to a
>CGI script. I have the following code:
>
>use CGI;
>my $Cgi = CGI->new();
>my $PostData = $Cgi->query_string;
>
>Is this the correct/best way?
>The reason I ask is that, for one user calling my script, the $PostData
>contents have the string ';keywords=' in place of any space character.
>For example, if the user was calling my script and passing 'hello
>world', $PostData would contain 'hello;keywords=world'.
You could also try:
#!/usr/bin/perl -wT
use strict;
my $buffer;
read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
print "Content-type: text/plain\n\n";
print $buffer;
__END__
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
|
|
|
|
|