I mean how much better do you want it to be? The connection was refused plain and simple and straightforward, check your firewall, your ports, your username, your password, make sure your rpcallowip is right, check everything.
I have double checked all those and none of that is the issue. I can do the following no problem:
$bitcoin->getbalance();
$bitcoin->move();
$bitcoin->listaccounts();
$bitcoin->getnewaddress();
$bitcoin->validateaddress();
$bitcoin->listreceivedbyaddress();
$bitcoin->listreceivedbyaccount();
All of those commands work fine for me, no errors or anything. There is no passphrase or anything currently on my wallet, and I can use both the sendtoaddress and sendmany command via command line, but using them via the jsonRPCClient, all I get is the connection refused. And its all on the localhost, no external server involved.