Title: PHP JSON sendfrom function Post by: sentry on May 09, 2011, 09:51:00 PM Would someone mind taking a look at this, I can't figure out what I'm doing wrong, it seems like it shouldn't be this difficult. I think the problem is my typecasts, whether its a string, int, or float.
Code: <?php I get this error: Code: Warning: fopen(http://...@127.0.0.1:8332) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in \www\classes\jsonRPCClient.php on line 132 print_r shows this for $bitcoin->listreceivedbyaccount() Code: Array ( [0] => Array ( [account] => Mining [label] => Mining [amount] => 3.07 [confirmations] => 424 ) [1] => Array ( [account] => Personal [label] => Personal [amount] => 0.99 [confirmations] => 1021 ) [2] => Array ( [account] => f899139df5e1059396431415e770c6dd [label] => f899139df5e1059396431415e770c6dd [amount] => 0.3 [confirmations] => 873 ) ) Title: Re: PHP JSON sendfrom function Post by: sentry on May 09, 2011, 11:04:37 PM I have figured this out, I overlooked that the wallet has no balance to send anything from ;D . I was able to use move though as the whole point of all this was to consolidate balances into one account. Although strangely enough I'm seeing ghost accounts that do not show up in the wallet but are listed by the RPC, oh well. For anyone following this and interested in the code, here ya go!
Code: <?php This simply moves all balances from accounts greater than 0 into the account you tell it to. I would really like to settle the negative accounts somehow, but I'll get into that soon. Needed this because on my bank project I have been working on my account shows I have a value > 0, but the wallet total shows 0... Title: Re: PHP JSON sendfrom function Post by: Alex Beckenham on May 19, 2011, 06:44:06 PM I've been trying to find documentation on what the sendfrom function actually returns...
True or false or something more detailed? Code: try { Edit: Okay just did a test and it appears to return a txid... is this documented anywhere handy yet? Had no luck searching for it in Google. Title: Re: PHP JSON sendfrom function Post by: m0Ray on May 20, 2011, 12:01:46 AM Look how I solved it here:
https://github.com/m0Ray/bitcoin_account Requires PHP 5.2 or higher. Title: Re: PHP JSON sendfrom function Post by: Alex Beckenham on May 20, 2011, 12:15:10 AM Thanks m0Ray, I'm taking a look now.
I also updated the 'sendfrom' details on this page: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list#Full_list Title: Re: PHP JSON sendfrom function Post by: m0Ray on May 20, 2011, 12:31:20 AM Note that original Sergio Vaccaro's jsonRPCClient class is modified.
|