I try to follow this PHP developer intro for bitcoin https://en.bitcoin.it/wiki/PHP_developer_intro
I make this steps on virtual dedicated server and everything works fine. But when I tried to perform the same steps on my virtual machine with OS fedora 14, the example from the article gives me an error:
Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://user:123456@127.0.0.1:8332/' in /var/www/html/jsonRPCClient.php:140
Stack trace:
#0 /var/www/html/btc.php(7): jsonRPCClient->__call('getbalance', Array)
#1 /var/www/html/btc.php(7): jsonRPCClient->getbalance()
#2 {main}
thrown in /var/www/html/jsonRPCClient.php on line 140
the code is:
<?php
require_once 'jsonRPCClient.php';
$bitcoin = new jsonRPCClient('http://user:123456@127.0.0.1:8332/');
echo "<pre>\n";
print_r($bitcoin->getbalance());
echo "</pre>";
?>
when I execute ./bitcoind getbalance or ./bitcoind getinfo in command line, I get answer, but php script doesn't work.
bitcion.conf:
rpcuser=user
rpcpassword=123456
rpcport=8332