Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: rdonohoe on April 12, 2011, 05:48:54 PM



Title: Newbie help with RPC and PHP
Post by: rdonohoe on April 12, 2011, 05:48:54 PM
Hi,

I am a new user and very interested in Bitcoin. I have been playing around with the RPC with PHP and I am getting a problem:

Code:
<?php

require_once 'jsonRPCClient.php';
 
  
$bitcoin = new jsonRPCClient('http://user:pass@127.0.0.1:8332/');
  
  
$balance $bitcoin->getbalance();
  echo 
$balance '</br>';
  
  
$send $bitcoin->sendtoaddress("1FmxuVaSpyGk732TbKroFE4ouSebpiz3nb 0.01");
  
  echo 
$send '</br>';
  
  
$balance $bitcoin->getbalance();
  echo 
$balance '</br>';

My problem is that nothing seems to happen after the first balance is echoed. The 0.01 is not sent and the 2nd balance echo is not done.

Any help would be great.



Title: Re: Newbie help with RPC and PHP
Post by: theymos on April 12, 2011, 06:16:26 PM
If I remember correctly, you use multiple parameters like this:
Code:
$send = $bitcoin->sendtoaddress("1FmxuVaSpyGk732TbKroFE4ouSebpiz3nb", 0.01);

It also might be an array:
Code:
$send = $bitcoin->sendtoaddress(array("1FmxuVaSpyGk732TbKroFE4ouSebpiz3nb", 0.01));