Bitcoin Forum
August 23, 2024, 04:46:31 PM *
News: All versions of Windows are affected by a critical security bug; make sure you update.
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: My code is wrong and I cant figure it out :-\  (Read 128 times)
The_Trader (OP)
Member
**
Offline Offline

Activity: 180
Merit: 52


View Profile
March 07, 2022, 04:18:50 PM
Last edit: March 07, 2022, 04:29:15 PM by The_Trader
Merited by Husires (2)
 #1



I am trying to display information from my vps wallet onto my php webpage, I have spent 2 days googling but to no avail, perhaps some one here could laugh at my code and correct it - or - suggest a better way to achieve what I am looking for.


   
Code:
  require_once 'jsonRPCClient.php';
  
  $bitcoin = new jsonRPCClient('http://xxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx@176.31.183.107:27772/');
  
  echo "<pre>\n";
  print_r($bitcoin->getbalance());
  echo "</pre>";


The result of the above is a white page, and on view source it displays

Code:
<pre>

Many thanks
henry_p
Newbie
*
Offline Offline

Activity: 22
Merit: 67


View Profile
March 07, 2022, 08:44:58 PM
Merited by LeGaulois (3), ABCbits (2)
 #2

I would try this:
Code:
  require_once 'jsonRPCClient.php';
 
  $bitcoin = new jsonRPCClient('http://xxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx@176.31.183.107:27772/');
  echo print_r($bitcoin);
  echo "<pre>\n";
  echo print_r($bitcoin->getbalance());
  echo "</pre>";

than look at the source of the page rendered.

print_r itself represent a string. You must echo it to print it.

If it appears that "bitcoin" is NULL or some error object, it may not be connecting. The info there you would get there may give you some insight.

You may also consider looking into:
Code:
ini_set('display_errors', 1);
error_reporting(E_ALL);
The_Trader (OP)
Member
**
Offline Offline

Activity: 180
Merit: 52


View Profile
March 07, 2022, 09:16:26 PM
 #3

I would try this:
Code:
  require_once 'jsonRPCClient.php';
 
  $bitcoin = new jsonRPCClient('http://xxxxxxxx:xxxxxxxxxxxxxxxxxxxxxx@176.31.183.107:27772/');
  echo print_r($bitcoin);
  echo "<pre>\n";
  echo print_r($bitcoin->getbalance());
  echo "</pre>";

than look at the source of the page rendered.

print_r itself represent a string. You must echo it to print it.

If it appears that "bitcoin" is NULL or some error object, it may not be connecting. The info there you would get there may give you some insight.

You may also consider looking into:
Code:
ini_set('display_errors', 1);
error_reporting(E_ALL);

It's throwing an error I have never seem before:

Code:
[07-Mar-2022 21:11:03 UTC] PHP Fatal error:  Uncaught Exception: Incorrect response id (request id: 1646687463, response id: ) 
Husires
Legendary
*
Offline Offline

Activity: 1596
Merit: 1288


View Profile WWW
March 09, 2022, 01:07:38 PM
 #4

It's throwing an error I have never seem before:

Code:
[07-Mar-2022 21:11:03 UTC] PHP Fatal error:  Uncaught Exception: Incorrect response id (request id: 1646687463, response id: ) 
PHP Fatal error is because of JSON-RPC.

you need to enable JSON-RPC check your Global Settings from tab 'Services'
you also need to setup your config like:


Code:
server=1
rpcallowip=127.0.0.1
daemon=1

check also if you whitelist your IP

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!