Author

Topic: Cant pull RPC credentials from my config.php file (Read 71 times)

member
Activity: 180
Merit: 52
I'm not that familiar with PHP so I could be wrong, but it looks like you're passing strings instead of variables here?:

Code:
$bitcoin = new Bitcoin('$rpc_user','$rpc_pass','$rpc_host','$rpc_port');

Instead, it should be like this:

Code:
$bitcoin = new Bitcoin($rpc_user,$rpc_pass,$rpc_host,$rpc_port);

Ha thank you OmegaStarScream

That was exactly what it was, I have been sat here for hours staring at it and trying to figure out what is wrong, I knew it would be simple i was just too pissed off to see it.

Again thanks for the prompt help it was appreciated Smiley

TT
staff
Activity: 3500
Merit: 6152
I'm not that familiar with PHP so I could be wrong, but it looks like you're passing strings instead of variables here?:

Code:
$bitcoin = new Bitcoin('$rpc_user','$rpc_pass','$rpc_host','$rpc_port');

Instead, it should be like this:

Code:
$bitcoin = new Bitcoin($rpc_user,$rpc_pass,$rpc_host,$rpc_port);
member
Activity: 180
Merit: 52
Hi all

So I want to display several things on a webpage in php ie getbalance, getblockheight etc etc

This was fine and everything was displaying as I wanted it too, but I found I was typing a lot of the same stuff so thought I would create a config to pull the info in from, however I am having issues as it wont connect to the wallet now.

My config:

Code:

$rpc_user 
'xxxxxxxxx';
$rpc_pass 'xxxxxxxxxxxxxxxxxxxxxx';
$rpc_host 'localhost';
$rpc_port 'xxxxx';

?>


My webpage:

Code:
include('config.php')
require_once(
'easybitcoin.php');

$bitcoin = new Bitcoin('$rpc_user','$rpc_pass','$rpc_host','$rpc_port');

$getbalance $bitcoin->getbalance();

print_r($getbalance);

?>

The above is a snipet of the webpage but if I can solve this bit then I can solve the rest, the config file is in the correct directory (the same as the index page)
I know the easybitcoin works because if i replace the $rpc_user etc with the actual details its is fine.

Any help would be most welcome, I suspect it is something real easy, that I can no longer see as im stressed out over it Smiley

Thanks
TT

Jump to: