Hi,
I am creating URI and sending JSON string in URL. while recieveing not able to print. Cab somebody please help?
cleint request code snippet:
my $json = { 'username' => 'foo',
'password' => 'bar',
};
my $encoded = to_json($json);
my $escaped = uri_escape($encoded); #string.
my $query = '&inputparms='.$escaped;
my $url = $rest_url.$query;
print "$url\n";
my $response = $ua->post($rest_url);
my $content = undef;
if ($response->is_success) {
$content = $response->content;
}
server side code snippet:
my $input = $PARMS{inputparms};
print qq{Content-type: application/json; charset=utf8\n\n};
my $in = from_json( $input, {utf8 => 1} );
my $jsonDecode = encode_json($in);
print "$jsonDecode\n";