Bitcoin Forum
June 20, 2024, 03:45:42 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Bitcoin Technical Support / Re: HELP ! im going crazy on: December 04, 2015, 11:08:14 AM
If i wanted to use the command line i wouldn't ask for php code. stop spamming
2  Bitcoin / Bitcoin Technical Support / Re: HELP ! im going crazy on: December 03, 2015, 05:07:00 PM
Yes other commands such getbalance , getinfo works. the private key is dumped with pywallet from wallet.dat also tried one private key dumped from blockchain .. same error.
3  Bitcoin / Bitcoin Technical Support / HELP ! im going crazy on: December 03, 2015, 04:31:26 PM
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-
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!