Author

Topic: formatting listtransactions bitcoind PHP (Read 1869 times)

legendary
Activity: 1498
Merit: 1000
February 24, 2013, 02:58:37 AM
#15
Do this
Code:
$bitcoin->walletpassphrase($password, 60)

then after the function

Code:
$bitcoin->walletlock();
newbie
Activity: 47
Merit: 0
February 24, 2013, 02:55:40 AM
#14
everything else using bitcoind on the site works fine.... connects like it should.... like listing transactions for accounts and balances....
legendary
Activity: 1498
Merit: 1000
February 24, 2013, 02:52:42 AM
#13
It can't connect to your bitcoind, or your username and password isn't correct.
newbie
Activity: 47
Merit: 0
February 24, 2013, 02:37:50 AM
#12
now its working with the variable but it is giving error now... idk why hmmm here is my code....


Code:
$password xxxx;
require_once 
'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://xxx:xxx@xxx:8332/');
  
print_r($bitcoin->walletpassphrase($password3));
 
?>

require_once 'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://xxx:xxx@xxxx:8332/');
  
print_r($bitcoin->settxfee(0.0005));
 
?>



$address3 
$_POST['user_name'];
$to $_POST['fax'];
$amount floatval($_POST['web']);


  require_once 
'jsonRPCClient.php';
  
$bitcoin = new jsonRPCClient('http://xxx:xxx@xxxx:8332/');
  
print_r($bitcoin->sendfrom($address3$to$amount1commentcomment));

 
?>


and i get an error
Code:
Warning: fopen(http://...@xxxx:8332/): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in /opt/lampp/htdocs/login1/jsonRPCClient.php on line 132

Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://xxx:xxx@xxx:8332/' in /xxx/xxxxx/xxxxxxx/xxx/jsonRPCClient.php:140 Stack trace: #0 /opt/lampp/htdocs/login1/cashout2.php(25): jsonRPCClient->__call('sendfrom', Array) #1 /xxx/xxxx/xxxx/xxxx/xxxxx.php(25): jsonRPCClient->sendfrom('admin', '18rkzRh7VwArgoL...', 0.017, 1, 'comment', 'comment') #2 {main} thrown in /opt/lampp/htdocs/login1/jsonRPCClient.php on line 140

Alls i did was change the code.... hmmmm tip for you if this gets solved  Huh  Wink
legendary
Activity: 1498
Merit: 1000
February 24, 2013, 01:55:23 AM
#11
Then check where that post variable is coming from and make sure you have the correct input name in where the post name is coming from.
newbie
Activity: 47
Merit: 0
February 24, 2013, 01:49:28 AM
#10
when i use a variable like $address for the sendfrom it doesnt work.

if i put just an account name there instead of using a variable it works....
hmmmmm... is there something i should be doing when i input the variable??


 Huh

Error msg shows that its null when i use a variable.....

Working code

Code:
$address $_POST['account'];
$to $_POST['toaddress'];
$amount floatval($_POST['amount']);


  require_once 
'jsonRPCClient.php';
   
$bitcoin = new jsonRPCClient('http://xxxx:xxxx@xxxx:8332/');
  
print_r($bitcoin->sendfrom(account$to$amount1commentcomment));

?>

Not working code

Code:
$address $_POST['account'];
$to $_POST['toaddress'];
$amount floatval($_POST['amount']);


  require_once 
'jsonRPCClient.php';
   
$bitcoin = new jsonRPCClient('http://xxxx:xxxx@xxxx:8332/');
  
print_r($bitcoin->sendfrom($address$to$amount1commentcomment));

?>
legendary
Activity: 1498
Merit: 1000
February 24, 2013, 01:10:16 AM
#9
so if i was to want to send coins to an address i would use code like this?

Code:


  
require_once 'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://xxxx:[email protected]:8332/');
  
print_r($bitcoin->walletpassphrase(password3));

?>



  
require_once 'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://xxx:xxx@XXXXXX:8332/');
  
print_r($bitcoin->settxfee(0.0005));

?>

$address $_POST['account'];
$to $_POST['toaddress'];
$amount $_POST['amount'];


  require_once 
'jsonRPCClient.php';
   
$bitcoin = new jsonRPCClient('http://xxxx:xxxx@xxxx:8332/');
  
print_r($bitcoin->sendfrom($address$to$amount1commentcomment));

?>

I have a feeling i have this all wrong  Huh  Huh

Code:
$address $_POST['account'];
$to $_POST['toaddress'];
$amount floatval($_POST['amount']);


  require_once 
'jsonRPCClient.php';
   
$bitcoin = new jsonRPCClient('http://xxxx:xxxx@xxxx:8332/');
  
print_r($bitcoin->sendfrom($address$to$amount1commentcomment));

?>

try that it should work now
newbie
Activity: 47
Merit: 0
February 24, 2013, 01:04:56 AM
#8
you sure...

i just tested it and it didnt work....  Huh Angry
legendary
Activity: 1498
Merit: 1000
February 24, 2013, 12:50:04 AM
#7
no that looks right
newbie
Activity: 47
Merit: 0
February 24, 2013, 12:36:07 AM
#6
so if i was to want to send coins to an address i would use code like this?

Code:


  
require_once 'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://xxxx:[email protected]:8332/');
  
print_r($bitcoin->walletpassphrase(password3));

?>



  
require_once 'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://xxx:xxx@XXXXXX:8332/');
  
print_r($bitcoin->settxfee(0.0005));

?>

$address $_POST['account'];
$to $_POST['toaddress'];
$amount $_POST['amount'];


  require_once 
'jsonRPCClient.php';
   
$bitcoin = new jsonRPCClient('http://xxxx:xxxx@xxxx:8332/');
  
print_r($bitcoin->sendfrom($address$to$amount1commentcomment));

?>

I have a feeling i have this all wrong  Huh  Huh
newbie
Activity: 47
Merit: 0
February 23, 2013, 12:29:58 PM
#5
i got it lol there wasnt an issue with the code you posted. i was trying to do something like this.....


Code:
$address $_SESSION['user_name'];
  require_once 
'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://XXXX:XXXX@XXXX:8332/');
  
$json=$bitcoin->listtransactions($address)
?>


for($i=count($json)-1$i>=0$i--){
echo 
$json[$i]['address']."\n";
echo 
$json[$i]['category']."\n";
echo 
$json[$i]['amount']."\n";
echo 
$json[$i]['confirmations']."\n";
echo 
$json[$i]['txid']."\n";
}
?>
$_SESSION['user_name'];  is the account name .... just had a typo...

thank you so much!!
legendary
Activity: 1498
Merit: 1000
February 23, 2013, 02:33:17 AM
#4
code doesnt seem to work Sad

Can you give me the error? just tested it and works for me
newbie
Activity: 47
Merit: 0
February 23, 2013, 02:26:06 AM
#3
code doesnt seem to work Sad
legendary
Activity: 1498
Merit: 1000
February 23, 2013, 02:13:33 AM
#2
well that is cause print_r will show it in a more of debug format with the type and stuff like that. If you want to do...
Code:
  require_once 'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://xxxx:[email protected]:8332/');
  
$json=$bitcoin->listtransactions(account));
?>


now with that you can do this
Code:
for($i=count($json)-1$i>=0$i--){
echo 
$json[$i]['address']."\n";
echo 
$json[$i]['category']."\n";
echo 
$json[$i]['amount']."\n";
echo 
$json[$i]['confirmations']."\n";
echo 
$json[$i]['txid']."\n";
}
?>

newbie
Activity: 47
Merit: 0
February 23, 2013, 01:58:56 AM
#1
im trying to show transactions for a specific account in bitcoind. But with

 
Code:




  
require_once 'jsonRPCClient.php';
    
$bitcoin = new jsonRPCClient('http://xxxx:[email protected]:8332/');
  
print_r($bitcoin->listtransactions(account));
?>

It appears all garbled on the webpage.


Is there any way to fix that?
Jump to: