Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: divergenta on May 13, 2011, 11:13:24 AM



Title: Stupid question about doing a transaction with php rpc
Post by: divergenta on May 13, 2011, 11:13:24 AM
                              


Assume that $account is a account with a balance in my bitcoind, $address is a valid address and that $amount is the amount of bitcoin that should be sent, I'm wondering if the following is the correct way to do a transaction using php:



  require_once 'jsonRPCClient.php';
  $bitcoin = new jsonRPCClient('http://usr:psw@127.0.0.1:8332/');
  $transaction = $bitcoin->sendfrom($account, $address, $amount);
  echo $transaction; // doing a echo to see the respone

Or am I doing anything wrong?


Title: Re: Stupid question about doing a transaction with php rpc
Post by: Gavin Andresen on May 13, 2011, 12:53:52 PM
Looks ok to me, assuming $account and $address are strings and $amount is a number.



Title: Re: Stupid question about doing a transaction with php rpc
Post by: divergenta on May 13, 2011, 01:43:24 PM
Ah, It works!

My $account was a integer and I just needed to convert it to a string and now it works like a charm. Thanks Gavin.