aither/aither-easy-php

一个简单的类,用于使用PHP调用Aither的RPC API

dev-master 2018-07-08 13:17 UTC

This package is not auto-updated.

Last update: 2024-09-23 15:56:21 UTC


README

由Alexandre (别名elbereth) Devilliers创建

一个简单的类,用于使用PHP调用Dash的RPC API。

入门指南

  1. 将aitherp.php包含到您的PHP脚本中

    require_once('aitherp.php');

  2. 初始化Dash连接/对象

    $aither = new \aither\Aitherp('username','password');

    可选,您可以指定主机和端口。默认是本地主机上的HTTP端口9998。

    $aither = new \aither\Aitherp('username','password','localhost','9998');

    如果您想建立SSL连接,可以设置可选的CA证书或留空 $aither->setSSL('/full/path/to/mycertificate.cert');

  3. 将dashd作为您对象的方法进行调用。示例

    $aither->getinfo();
    $aither->getrawtransaction('0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098',1);
    $aither->getblock('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f');
    $aither->mnbudget('show');

附加信息

  • 如果调用失败,无论什么原因,它将返回false,并将错误消息放入$aither->error

  • HTTP状态代码可以在$aither->status中找到,要么是有效的HTTP状态代码,要么是0,如果cURL无法连接。

  • 完整的响应(通常不需要)存储在$aither->response中,而原始JSON存储在$aither->raw_response中

贡献信息

原始代码在MIT许可下。