Reputation: 66490
On my server I don't have CGI installed is it possible to get Raw Post Data without that module? I've try to check the source code for CGI.pm but didn't found anythig.
Upvotes: 0
Views: 1008
Reputation: 156
You can extract POST data by reading from STDIN. (Viewing raw POST data)
paramExtractor.cgi
#!/usr/bin/perl
use strict;
use warnings;
my $buffer = '';
if($ENV{CONTENT_LENGTH}) { read(STDIN,$buffer,$ENV{CONTENT_LENGTH}); }
print "Content-type: text/plain\n\n";
print 'Post data is (' . length($buffer) . " chars):\n";
if( ! length($buffer) ) { $buffer = '[No POST data received]'; }
print $buffer;
exit;
form.html
<form method="post" action="http://127.0.0.1/paramExtractor.cgi">
<table cellpadding="3">
<tr>
<td>Name:</td>
<td><input type="text" name="name" style="width:200px;"></td>
</tr><tr>
<td>Email:</td>
<td><input type="text" name="email" style="width:200px;"></td>
</tr><tr>
<td valign="top">Message:</td>
<td><textarea name="message" style="width:200px; height:75px;"></textarea></td>
</tr><tr>
<td> </td>
<td><input type="submit" style="width:200px;"></td>
</tr>
</table>
</form>
Upvotes: 2