AM
Size: a a a
AM
AM
✔R
A
CI
CI
CI
✔R
CI
✔R
CI
✔R
CI
CI
KL
ИИ
M
s
$config = parse_ini_file("dash.conf");SDK подьехало))
$port = $config['testnet']==1?'19998':'9998';
$dash = new DASHWrapper("http://{$config['rpcuser']}:{$config['rpcpassword']}@127.0.0.1:{$port}/");
$tx = $dash->getrawtransaction($txId, true);
/**
* @method getrawtransaction(string $tx, bool $verbose)
* @method validateaddress(string $address)
* @method getaddressbalance(array $addresses)
*/
class DASHWrapper {
private $ch;
public function __construct(string $connection) {
$this->ch = curl_init($connection);
if (!$this->ch) {
throw new Exception('Не удалось подключиться к демону');
}
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, ['Content-Type: text/plain']);
curl_setopt($this->ch, CURLOPT_POST, true);
}
public function __call($name, $arguments) {
$params = json_encode([
"jsonrpc" => "1.0",
"id" => "PHP-wrapper",
"method" => $name,
"params" => $arguments,
]);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $params);
$result = curl_exec($this->ch);
if (empty($result)) {
throw new Exception(curl_error($this->ch));
}
$response = json_decode($result, true);
return !empty($response['result']) ? $response['result'] : "{$response['error']['message']}\n";
}
}
s
$config = parse_ini_file("dash.conf");SDK подьехало))
$port = $config['testnet']==1?'19998':'9998';
$dash = new DASHWrapper("http://{$config['rpcuser']}:{$config['rpcpassword']}@127.0.0.1:{$port}/");
$tx = $dash->getrawtransaction($txId, true);
/**
* @method getrawtransaction(string $tx, bool $verbose)
* @method validateaddress(string $address)
* @method getaddressbalance(array $addresses)
*/
class DASHWrapper {
private $ch;
public function __construct(string $connection) {
$this->ch = curl_init($connection);
if (!$this->ch) {
throw new Exception('Не удалось подключиться к демону');
}
curl_setopt($this->ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($this->ch, CURLOPT_HTTPHEADER, ['Content-Type: text/plain']);
curl_setopt($this->ch, CURLOPT_POST, true);
}
public function __call($name, $arguments) {
$params = json_encode([
"jsonrpc" => "1.0",
"id" => "PHP-wrapper",
"method" => $name,
"params" => $arguments,
]);
curl_setopt($this->ch, CURLOPT_POSTFIELDS, $params);
$result = curl_exec($this->ch);
if (empty($result)) {
throw new Exception(curl_error($this->ch));
}
$response = json_decode($result, true);
return !empty($response['result']) ? $response['result'] : "{$response['error']['message']}\n";
}
}