A fork from aceat64/EasyBitcoin-PHP, just adapted to the need of the CLcoin ( change prot, etc..). All I did was just replacing "Bitcoin" by "CLcoin". A simple class for making calls to CLcoin's API using PHP.
-
Include clcoin.php into your PHP script:
require_once('clcoin.php');
-
Initialize CLcoin connection/object:
$client = new CLcoin('username','password');
Optionally, you can specify a host, port. Default is HTTP on localhost port 2332.
$client = new CLcoin('username','password','localhost','2332');
If you wish to make an SSL connection you can set an optional CA certificate or leave blank
$client->setSSL('/full/path/to/mycertificate.cert');
-
Make calls to CLcoind as methods for your object. Examples:
$client->getinfo(); $client->getrawtransaction('0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098',1); $client->getblock('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f');
List of available methods :
addmultisigaddress <'["key","key"]'> [account]
addnode <add|remove|onetry>
backupwallet
createmultisig <'["key","key"]'>
createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}
decoderawtransaction
dumpprivkey
encryptwallet
getaccount
getaccountaddress
getaddednodeinfo [node]
getaddressesbyaccount
getbalance [account] [minconf=1]
getbestblockhash
getblock [verbose=true]
getblockcount
getblockhash
getblocktemplate [params]
getconnectioncount
getdifficulty
getgenerate
gethashespersec
getinfo
getmininginfo getnetworkhashps [blocks] [height]
getnewaddress [account]
getnormalizedtxid
getpeerinfo
getrawmempool
getrawtransaction [verbose=0]
getreceivedbyaccount [minconf=1]
getreceivedbyaddress [minconf=1]
gettransaction
gettxout [includemempool=true]
gettxoutsetinfo
getwork [data]
getworkex [data, coinbase]
help [command]
importprivkey [label] [rescan=true]
keypoolrefill
listaccounts [minconf=1]
listaddressgroupings
listlockunspent
listreceivedbyaccount [minconf=1] [includeempty=false]
listreceivedbyaddress [minconf=1] [includeempty=false]
listsinceblock [blockhash] [target-confirmations]
listtransactions [account] [count=10] [from=0]
listunspent [minconf=1] [maxconf=9999999] ["address",...]
lockunspent unlock? [array-of-Objects]
move [minconf=1] [comment]
sendfrom [minconf=1] [comment] [comment-to]
sendmany {address:amount,...} [minconf=1] [comment]
sendrawtransaction [allowhighfees=false]
sendtoaddress [comment] [comment-to]
setaccount
setgenerate [genproclimit]
setmininput
settxfee <amount CLC/KB>
signmessage
signrawtransaction [{"txid":txid,"vout":n,"scriptPubKey":hex,"redeemScript":hex},...] [,...] [sighashtype="ALL"]
stop
submitblock [optional-params-obj]
validateaddress
verifychain [check level] [num blocks]
verifymessage
-
When a call fails for any reason, it will return false and put the error message in
$client->error
-
The HTTP status code can be found in $client->status and will either be a valid HTTP status code or will be 0 if cURL was unable to connect.
-
The full response (not usually needed) is stored in
$client->response
while the raw JSON is stored in$client->raw_response