in reply to Re: POST array of hashes CGI
in thread POST array of hashes CGI
Hi, it's most common nowadays to pass JSON around in requests and responses as the entire body (see, e.g., almost any API you use). Try this:
... and ...#use HTTP::Request::Common; use HTTP::Request; my $request = HTTP::Request->new(POST => $url); $request->header( 'Content-Type' => 'application/json' ); $request->content( $json ); ...
(see https://metacpan.org/pod/release/LDS/CGI.pm-3.43/CGI.pm#HANDLING_NON-URLENCODED_ARGUMENTS)my $json = $query->param('POSTDATA'); my $data = decode_json( $json ); ...
Hope this helps!
|
|---|