PHP code example of turtlecoin / turtlecoin-walletd-rpc-php
1. Go to this page and download the library: Download turtlecoin/turtlecoin-walletd-rpc-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
turtlecoin / turtlecoin-walletd-rpc-php example snippets
use TurtleCoin\TurtleCoind;
$config = [
'rpcHost' => 'http://127.0.0.1',
'rpcPort' => 11898,
];
$turtlecoind = new TurtleCoind($config);
echo $turtlecoind->getBlockCount();
> {"id":2,"jsonrpc":"2.0","result":{"count":784547,"status":"OK"}}
$response = $turtleService->getBalance($walletAddress);
// The result field from the RPC response
$response->result();
// RPC response as JSON string
$response->toJson();
// RPC response as an array
$response->toArray();
// Or other response details
$response->getStatusCode();
$response->getProtocolVersion();
$response->getHeaders();
$response->hasHeader($header);
$response->getHeader($header);
$response->getHeaderLine($header);
$response->getBody();
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.