Chris
Chris

Reputation: 26878

Raw POST data in Perl?

In PHP, php://input enables to read the raw request body data, which is what I need in this case. However the rest of the server-side backbone is all written in PERL, so I tried to find the alternative to php://input -- I couldn't.

Short question:

How can one get the raw POST data (request body) in Perl? (the CGI variable showed absolutely nothing).

Thanks!

Upvotes: 4

Views: 2984

Answers (1)

ikegami
ikegami

Reputation: 385565

From the CGI module's docs,

If POSTed data is not of type application/x-www-form-urlencoded or multipart/form-data, then the POSTed data will not be processed, but instead be returned as-is in a parameter named POSTDATA. To retrieve it, use code like this:

my $data = $query->param('POSTDATA');

Upvotes: 7

Related Questions