So im trying to import an private key to bitcoin using php... no luck in couple of hours
here is the script
<?php
/* Configuration variables for the JSON-RPC server */
$rpc_host = '127.0.0.1';
$rpc_port = '8332';
$rpc_user = 'root';
$rpc_pass = 'root123';
set_time_limit(3600);
require_once('jsonRPCClient.php');
$bc = new jsonRPCClient('http://' . $rpc_user . ':' . $rpc_pass . '@' . $rpc_host . ':' . $rpc_port);
$bc->importprivkey("privatekey","root");
print_r($bc->getaddressesbyaccount($rpc_user));
$balance = $bc->getbalance()."\n";
echo $balance;
?>
here is the output
Warning: fopen(http://...@127.0.0.1:8332): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\xampp\htdocs\jsonRPCClient.php on line 132
Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to
http://root:root123@127.0.0.1:8332' in C:\xampp\htdocs\jsonRPCClient.php:140 Stack trace: #0 C:\xampp\htdocs\test.php(13): jsonRPCClient->__call('importprivkey', Array) #1 C:\xampp\htdocs\test.php(13): jsonRPCClient-