Title: Cant pull RPC credentials from my config.php file Post by: The_Trader on April 07, 2023, 01:07:37 PM 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 My webpage: Code: <?php 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 :) Thanks TT Title: Re: Cant pull RPC credentials from my config.php file Post by: OmegaStarScream on April 07, 2023, 01:13:19 PM 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); Title: Re: Cant pull RPC credentials from my config.php file Post by: The_Trader on April 07, 2023, 01:26:12 PM 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 :) TT |