2
1
I'm trying to make a simple request to bitcoind using perl I followed the example from the API reference, but it fails saying "401 Authorization Required"
#!/usr/bin/perl -w
use JSON::RPC::Client;
use Data::Dumper;
my $client = new JSON::RPC::Client;
$client->ua->credentials(
'localhost:8332', 'jsonrpc', 'bitcoinrpc' => 'mybitcoinrpcpassword' # REPLACE WITH YOUR bitcoin.conf rpcuser/rpcpassword
);
my $uri = 'http://localhost:8332/';
my $obj = {
method => 'getinfo',
params => [],
};
my $res = $client->call( $uri, $obj );
if ($res){
if ($res->is_error) { print "Error : ", $res->error_message; }
else { print Dumper($res->result); }
} else {
print $client->status_line;
}
Am I missing something obvious? Thanks for any help!
You can use --datadir instead. – Tom van der Woerdt – 2013-05-04T16:42:56.800
1Sounds like a bug! Did you report it? – Noldorin – 2016-04-10T01:48:41.123