Bitcoind server connection problem

0 votes

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
Aug 23, 2018 in Blockchain by slayer
• 29,370 points
963 views

1 answer to this question.

0 votes

Be sure to allow your server ip (where the php part located!)

    rpcuser=user

    rpcpassword=123456

    rpcport=8332

    rpcallowip=192.168.0.123 (server php ip)
answered Aug 23, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

How to solve Yobit API connection 503 server error?

Try to use "https://www.yobit.net/api/3/info" URL Instead of ...READ MORE

answered Aug 21, 2018 in Blockchain by slayer
• 29,370 points
847 views
0 votes
1 answer
+4 votes
2 answers

I am unable to connect Ganache with Truffle/Npm Dev server. Pls help.

The issue is at CurrentProvider. Give the url ...READ MORE

answered Mar 26, 2018 in Blockchain by Perry
• 17,100 points

edited Oct 11, 2018 by Omkar 2,738 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,740 points
45,298 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
928 views
0 votes
1 answer

Cant connect Jsonrpc to bitcoin.

I tried the following code and it ...READ MORE

answered Aug 20, 2018 in Blockchain by digger
• 26,740 points
1,037 views
0 votes
1 answer

How to use Proc/lamba returned from a method in Ruby?

You need to remove the colon: list.select(&valid_transaction) The & ...READ MORE

answered Aug 24, 2018 in Blockchain by digger
• 26,740 points
711 views
+1 vote
1 answer

What problem does pow(proof of work) solves in blockchain?

Proof of Work: When a miner gets a ...READ MORE

answered Aug 6, 2018 in Blockchain by digger
• 26,740 points
1,217 views
0 votes
1 answer

Why is there no infinite loop problem in Hyperledger Fabric?

Hyperledger uses a timeout mechanism for chaincode ...READ MORE

answered Jul 30, 2018 in Blockchain by digger
• 26,740 points
1,005 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP