Post
Topic
Board Project Development
Merits 6 from 1 user
Topic OP
Cant pull RPC credentials from my config.php file
by
The_Trader
on 07/04/2023, 13:07:37 UTC
⭐ Merited by hugeblack (6)
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:
<?php

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

?>


My webpage:

Code:
<?php
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