I am using the json-rpc php library from the bitcoin wiki (
http://jsonrpcphp.org/) to send commands to my bitcoind instance. For the most part, it works as expected, but occasionally, when I use the sendtoaddress command, it will return one of the following errors:
fopen(http://...@localhost:8334/): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
or
fopen(http://...@localhost:8334/): failed to open stream: HTTP request failed!
I noticed that the first one seems to happen only when there are insufficient funds in the wallet. The second seems to happen at random. When the first occurs, no coins are sent. When the second occurs, the coins are almost always sent just as if there was no error even though it seems, based on the error, that the command never made it to bitcoind. Occasionally though, the second error will be returned and the coins aren't sent.
This ambiguity is a problem for me. What I would really like is for the jsonrpc client to return a meaningful error when it cannot process the request (such as insufficient funds) and to return the usual output (txid) when sendtoaddress is successfully executed. I'm most comfortable in php, but am willing to learn other languages to achieve the same ends. Ultimately I need to take addresses/amounts from a mysql database and construct transactions in my bitcoind server.
So, if anyone knows how to make this work in php or another language, perhaps perl or ruby or python and can walk me though it, and it works as described, 5 btc will be yours.