#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use JSON; my $client = new LWP::UserAgent; my $json = new JSON; my %request=('commandlet'=>'memory','output'=>'json'); my $json_request = $json->encode(\%request); my $web_request = $client->post('http://localhost:12345/query',{ username => 'default', password => 'changeme', json => $json_request }); print $web_request->content; #### #!/usr/bin/perl use strict; use warnings; use JSON; my $json = new JSON; my %request=('commandlet'=>'memory','output'=>'json'); my $json_data=$json->encode(\%request); my $command=sprintf"/usr/bin/curl -d username='%s' -d password='%s' --data-urlencode json='%s' http://localhost:12345/query 2>/dev/null|","default","changeme",$json_data; open FH,$command; while (){ print $_; } close FH; #### Using curl: real 0m4.006s user 0m3.060s sys 0m0.740s Using LWP real 0m12.978s user 0m11.405s sys 0m1.184s