Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use WWW::Mechanize;
- use JSON qw/encode_json/;
- my $username = 'test';
- my $password = 'test';
- my $url = 'http://localhost:9990/management';
- for (my $i=0; $i<100; $i++) {
- my $method = WWW::Mechanize->new(autocheck => 1);
- my $data = encode_json {"operation" => "read-attribute","name" => "server-state", "json.pretty" => 1};
- $method->add_header('Accept'=>'text/plain');
- $method->add_header('Content-Type'=>'application/json');
- $method->credentials("localhost:9990","ManagementRealm", $username=>$password);
- $method->post($url, content=>$data );
- my $result = JSON::XS->new->allow_nonref->decode($method->content());
- print "$i - $result->{result}\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement