当前位置: 首页>>代码示例>>PHP>>正文


PHP jsonRPCClient::getinfo方法代码示例

本文整理汇总了PHP中jsonRPCClient::getinfo方法的典型用法代码示例。如果您正苦于以下问题:PHP jsonRPCClient::getinfo方法的具体用法?PHP jsonRPCClient::getinfo怎么用?PHP jsonRPCClient::getinfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jsonRPCClient的用法示例。


在下文中一共展示了jsonRPCClient::getinfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bitcoin_link

function bitcoin_link($params)
{
    # Gateway Specific Variables
    $u = $params['username'];
    $p = $params['password'];
    $h = $params['host'] . ':' . $params['port'];
    $rpc = 'http://' . $u . ':' . $p . '@' . $h;
    # Invoice Variables
    $invoiceid = $params['invoiceid'];
    $amount = $params['amount'];
    # Format: ##.##
    $currency = $params['currency'];
    # Currency Code
    # Client Variables
    $firstname = $params['clientdetails']['firstname'];
    $lastname = $params['clientdetails']['lastname'];
    $email = $params['clientdetails']['email'];
    $address1 = $params['clientdetails']['address1'];
    $address2 = $params['clientdetails']['address2'];
    $city = $params['clientdetails']['city'];
    $state = $params['clientdetails']['state'];
    $postcode = $params['clientdetails']['postcode'];
    $country = $params['clientdetails']['country'];
    $phone = $params['clientdetails']['phonenumber'];
    # Build Bitcoin Information Here
    require_once 'bitcoin/jsonRPCClient.php';
    $bitcoin = new jsonRPCClient($rpc);
    if (!$bitcoin->getinfo()) {
        die('could not connect to bitcoind');
    }
    $address = $bitcoin->getaccountaddress($params['clientdetails']['userid'] . '-' . $invoiceid);
    # Enter your code submit to the gateway...
    $code = 'Send Payments to: ' . $address . '';
    return $code;
}
开发者ID:carriercomm,项目名称:WHMCS-Bitcoin-Payment-Module,代码行数:35,代码来源:bitcoin.php

示例2: confirm_sent

 public function confirm_sent()
 {
     $this->load->model('checkout/order');
     $order_id = $this->session->data['order_id'];
     $order = $this->model_checkout_order->getOrder($order_id);
     $current_default_currency = $this->config->get('config_currency');
     $eMark_DEM_decimal = $this->config->get('eMark_DEM_decimal');
     $eMark_total = $order['eMark_total'];
     $eMark_address = $order['eMark_address'];
     require_once 'jsonRPCClient.php';
     $eMark = new jsonRPCClient('http://' . $this->config->get('eMark_rpc_username') . ':' . $this->config->get('eMark_rpc_password') . '@' . $this->config->get('eMark_rpc_address') . ':' . $this->config->get('eMark_rpc_port') . '/');
     try {
         $eMark_info = $eMark->getinfo();
     } catch (Exception $e) {
         $this->data['error'] = true;
     }
     try {
         $received_amount = $eMark->getreceivedbyaddress($eMark_address, 0);
         if (round((double) $received_amount, $eMark_DEM_decimal) >= round((double) $eMark_total, $eMark_DEM_decimal)) {
             $order = $this->model_checkout_order->getOrder($order_id);
             $this->model_checkout_order->confirm($order_id, $this->config->get('eMark_order_status_id'));
             echo "1";
         } else {
             echo "0";
         }
     } catch (Exception $e) {
         $this->data['error'] = true;
         echo "0";
     }
 }
开发者ID:Rumhocker,项目名称:OpenCart_eMark,代码行数:30,代码来源:eMark.php

示例3: can_connect

 /**
 * Test if the connection to the Bitcoin JSON-RPC server is working
 *
 * The check is done by calling the server's getinfo() method and checking
 * for a fault.
 *
 * @return mixed boolean TRUE if successful, or a fault string otherwise
 * @access public
 * @throws none
 */
 public function can_connect()
 {
     try {
         $r = parent::getinfo();
     } catch (Exception $e) {
         return $e->getMessage();
     }
     return true;
 }
开发者ID:iamraghavgupta,项目名称:openfaucet,代码行数:19,代码来源:bitcoin.class.php

示例4: funct_Billing_JSONRPC_GetInfo

function funct_Billing_JSONRPC_GetInfo($strConnectionString)
{
    //works
    //get info about wallet as | delimited string
    if (!$strConnectionString) {
        $strConnectionString = JSONRPC_CONNECTIONSTRING;
    }
    //echo "conn = $strConnectionString <br>";
    $mybtc = new jsonRPCClient($strConnectionString);
    $strReturnInfo = $mybtc->getinfo();
    //echo "array=$strReturnInfo<br>";
    foreach ($strReturnInfo as $key => $value) {
        //echo $key."=".$value."<br>";
        $strReturn = $strReturn . $key . "=" . $value . "|";
    }
    return $strReturn;
}
开发者ID:bitcoinbrisbane,项目名称:EzBitcoin-Api-Wallet,代码行数:17,代码来源:funct_jsonrpc.php

示例5: confirm_sent

 public function confirm_sent()
 {
     $this->load->model('checkout/order');
     $order_id = $this->session->data['order_id'];
     $order = $this->model_checkout_order->getOrder($order_id);
     $current_default_currency = $this->config->get('config_currency');
     $bitcoin_btc_decimal = $this->config->get('bitcoin_btc_decimal');
     $bitcoin_total = $order['bitcoin_total'];
     $bitcoin_address = $order['bitcoin_address'];
     if (!$this->config->get('bitcoin_blockchain')) {
         require_once 'jsonRPCClient.php';
         $bitcoin = new jsonRPCClient('http://' . $this->config->get('bitcoin_rpc_username') . ':' . $this->config->get('bitcoin_rpc_password') . '@' . $this->config->get('bitcoin_rpc_address') . ':' . $this->config->get('bitcoin_rpc_port') . '/');
         try {
             $bitcoin_info = $bitcoin->getinfo();
         } catch (Exception $e) {
             $this->data['error'] = true;
         }
     }
     try {
         if (!$this->config->get('bitcoin_blockchain')) {
             $received_amount = $bitcoin->getreceivedbyaddress($bitcoin_address, 0);
         } else {
             static $ch = null;
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; Blockchain.info PHP client; ' . php_uname('s') . '; PHP/' . phpversion() . ')');
             curl_setopt($ch, CURLOPT_URL, 'http://blockchain.info/q/getreceivedbyaddress/' . $bitcoin_address . '?confirmations=0');
             $res = curl_exec($ch);
             if ($res === false) {
                 throw new Exception('Could not get reply: ' . curl_error($ch));
             }
             $received_amount = $res / 100000000;
         }
         if (round((double) $received_amount, $bitcoin_btc_decimal) >= round((double) $bitcoin_total, $bitcoin_btc_decimal)) {
             $order = $this->model_checkout_order->getOrder($order_id);
             $this->model_checkout_order->confirm($order_id, $this->config->get('bitcoin_order_status_id'));
             echo "1";
         } else {
             echo "0";
         }
     } catch (Exception $e) {
         $this->data['error'] = true;
         echo "0";
     }
 }
开发者ID:blackchat,项目名称:OpenCart_Bitcoin,代码行数:45,代码来源:bitcoin.php

示例6: confirm_sent

 public function confirm_sent()
 {
     $this->load->model('checkout/order');
     $order_id = $this->session->data['order_id'];
     $order = $this->model_checkout_order->getOrder($order_id);
     $current_default_currency = "USD";
     $hazecoin_total = round($this->currency->convert($order['total'], $current_default_currency, "haze"), 4);
     require_once 'jsonRPCClient.php';
     $hazecoin = new jsonRPCClient('http://' . $this->config->get('hazecoin_rpc_username') . ':' . $this->config->get('hazecoin_rpc_password') . '@' . $this->config->get('hazecoin_rpc_address') . ':' . $this->config->get('hazecoin_rpc_port') . '/');
     try {
         $hazecoin_info = $hazecoin->getinfo();
     } catch (Exception $e) {
         $this->data['error'] = true;
     }
     $received_amount = $hazecoin->getreceivedbyaccount($this->config->get('hazecoin_prefix') . '_' . $order_id, 0);
     if (round((double) $received_amount, 4) >= round((double) $hazecoin_total, 4)) {
         $order = $this->model_checkout_order->getOrder($order_id);
         $this->model_checkout_order->confirm($order_id, $this->config->get('hazecoin_order_status_id'));
         echo true;
     } else {
         echo false;
     }
 }
开发者ID:HazeDev,项目名称:OpenCart_Hazecoin,代码行数:23,代码来源:hazecoin.php

示例7: litecoin_link

function litecoin_link($params)
{
    full_query("CREATE TABLE IF NOT EXISTS `mod_gw_litecoin_payments` (`invoice_id` int(11) NOT NULL, `amount` float(11,8) NOT NULL, `address` varchar(64) NOT NULL, `confirmations` int(11) NOT NULL, PRIMARY KEY (`invoice_id`))");
    full_query("CREATE TABLE IF NOT EXISTS `mod_gw_litecoin_info` (`invoice_id` int(11) NOT NULL, `secret` varchar(64) NOT NULL, `address` varchar(64) NOT NULL, PRIMARY KEY (`invoice_id`))");
    $q = mysql_fetch_array(mysql_query("SELECT * FROM `mod_gw_litecoin_info` WHERE invoice_id = '{$params['invoiceid']}'"));
    if ($q['address']) {
        $amount = $q['amount'];
        $address = $q['address'];
    }
    $secret = '';
    $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
    for ($i = 0; $i < 64; $i++) {
        $secret .= substr($characters, rand(0, strlen($characters) - 1), 1);
    }
    # Grab the amount and everything from BTC-e's ticker
    $ltc_ticker = json_decode(file_get_contents("https://btc-e.com/api/2/ltc_usd/ticker"), true);
    if (!$ltc_ticker) {
        return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time.";
    }
    $amount = round($params['amount'] / $ltc_ticker['ticker']['sell'], 8);
    # Build Litecoin Information Here
    require_once 'whmcscoin/jsonRPCClient.php';
    $litecoin = new jsonRPCClient("http://{$params['username']}:{$params['password']}@{$params['host']}:{$params['port']}");
    if (!$litecoin->getinfo()) {
        //This won't work. Gotta make this work.
        return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time.";
    }
    $address = $litecoin->getaccountaddress($secret);
    if (!$address) {
        //This probably won't work either.{
        return "We're sorry, but you cannot use Litecoin to pay for this transaction at this time.";
    }
    $code = 'Please send <strong>' . $params['amount'] . '</strong>worth of LTC to address:<br /><strong><a href="#">' . $address . '</a></strong><br /><span id="ltcprice">Currently, ' . $params['amount'] . ' is <strong>' . $amount . '</strong> LTC</span>';
    mysql_query("INSERT INTO `mod_gw_litecoin_info` SET invoice_id = '{$params['invoiceid']}', address = '" . mysql_real_escape_string($address) . "', secret = '{$secret}'");
    return "<iframe src='{$params['systemurl']}/modules/gateways/litecoin.php?invoice={$params['invoiceid']}' style='border:none; height:120px'>Your browser does not support frames.</iframe>";
    return $code;
}
开发者ID:habibmasuro,项目名称:whmcscoin,代码行数:37,代码来源:litecoin.php

示例8: getGatewayVariables

$gatewaymodule = "litecoin";
# Enter your gateway module name here replacing template
$GATEWAY = getGatewayVariables($gatewaymodule);
if (!$GATEWAY["type"]) {
    die("Module Not Activated");
}
# Checks gateway module is active before accepting callback
# Gateway Specific Variables
$u = $GATEWAY['username'];
$p = $GATEWAY['password'];
$h = $GATEWAY['host'] . ':' . $GATEWAY['port'];
$rpc = 'http://' . $u . ':' . $p . '@' . $h;
# Build Litecoin Information Here
require_once '../litcoin/jsonRPCClient.php';
$litecoin = new jsonRPCClient($rpc);
if (!$litecoin->getinfo()) {
    die('could not connect to litcoind');
}
$sql = 'SELECT * FROM tblinvoices WHERE paymentmethod="' . $gatewaymodule . '" AND status = "Unpaid"';
$results = mysql_query($sql);
while ($result = mysql_fetch_array($results)) {
    $amount = $result['total'];
    $btcaccount = $result['userid'] . '-' . $result['id'];
    $received = $litecoin->getbalance($btcaccount);
    //print($received);
    if ($amount <= $received) {
        //echo 'PAID';
        $fee = 0;
        $transid = $litecoin->getaccountaddress($btcaccount . '-' . $result['id']);
        //checkCbTransID($transid);
        addInvoicePayment($result['id'], $transid, $received, $fee, $gatewaymodule);
开发者ID:Artea,项目名称:WHMCS-Litecoin-Payment-Module,代码行数:31,代码来源:litcoin.php

示例9: jsonRPCClient

ユーザー名:
<input type=text size="40" name="username" value=""><br />
<input type="submit" name="param" value="アドレス取得">
<input type="submit" name="param" value="入金チェック">
</form>
<?php 
require_once __DIR__ . '/jsonRPCClient.php';
$host = 'localhost';
/* monacoind 又は monacoin-qt を実行中のホストのアドレス */
$rpcuser = 'monacoinrpc';
/* monacoin.conf で指定した rpcユーザー名 */
$rpcpassword = 'aaaaa';
/* monacoin.conf で指定した rpcパスワード */
$rpcport = '4000';
/* monacoin.conf で指定した rpcポート */
$historyNum = 50;
/* 取得するトランザクション数 */
/* monacoind への接続アドレス */
$coindaddr = "http://{$rpcuser}:{$rpcpassword}@{$host}:{$rpcport}/";
$coind = new jsonRPCClient($coindaddr);
$info = $coind->getinfo();
echo "Balance: <div id=balance>{$info['balance']}</div>";
$list = $coind->listaccounts();
print_r($list);
?>
<div id="COUNTDOWN">0</div>
<div id="BTCMONA">wait</div>
</body>
</html>

开发者ID:you21979,项目名称:mona_sample,代码行数:29,代码来源:index.php

示例10: jsonRPCClient

require "jsonRPCClient.php";
session_start();
if (isset($_POST['currentWallet']) && !empty($_POST['currentWallet'])) {
    $_SESSION['currentWallet'] = $_POST['currentWallet'];
}
if (isset($_SESSION['currentWallet']) && !empty($_SESSION['currentWallet'])) {
    $currentWallet = $_SESSION['currentWallet'];
} else {
    $keys = array_keys($wallets);
    $currentWallet = $keys[0];
    $_SESSION['currentWallet'] = $currentWallet;
}
$nmcu = $wallets[$currentWallet];
$nmc = new jsonRPCClient("{$nmcu['protocol']}://{$nmcu['user']}:{$nmcu['pass']}@{$nmcu['host']}:{$nmcu['port']}", true);
try {
    $nmcinfo = $nmc->getinfo();
} catch (exception $e) {
    die("Failed to retrieve data from the daemon, please check your configuration, and ensure that your coin daemon is running:<br>  {$e}");
}
$wallet_encrypted = true;
try {
    $nmc->walletlock();
} catch (Exception $e) {
    // Wallet is not encrypted
    $wallet_encrypted = false;
}
// Begin bootstrap code
?>
<!DOCTYPE html>
<html lang='en'>
<head>
开发者ID:perfect-coin,项目名称:-Coin,代码行数:31,代码来源:header.php

示例11: getGatewayVariables

$gatewaymodule = "bitcoin";
# Enter your gateway module name here replacing template
$GATEWAY = getGatewayVariables($gatewaymodule);
if (!$GATEWAY["type"]) {
    die("Module Not Activated");
}
# Checks gateway module is active before accepting callback
# Gateway Specific Variables
$u = $GATEWAY['username'];
$p = $GATEWAY['password'];
$h = $GATEWAY['host'] . ':' . $GATEWAY['port'];
$rpc = 'http://' . $u . ':' . $p . '@' . $h;
# Build Bitcoin Information Here
require_once '../bitcoin/jsonRPCClient.php';
$bitcoin = new jsonRPCClient($rpc);
if (!$bitcoin->getinfo()) {
    die('could not connect to bitcoind');
}
$sql = 'SELECT * FROM tblinvoices WHERE paymentmethod="' . $gatewaymodule . '" AND status = "Unpaid"';
$results = mysql_query($sql);
while ($result = mysql_fetch_array($results)) {
    $amount = $result['total'];
    $btcaccount = $result['userid'] . '-' . $result['id'];
    $received = $bitcoin->getbalance($btcaccount);
    //print($received);
    if ($amount <= $received) {
        //echo 'PAID';
        $fee = 0;
        $transid = $bitcoin->getaccountaddress($btcaccount . '-' . $result['id']);
        //checkCbTransID($transid);
        addInvoicePayment($result['id'], $transid, $received, $fee, $gatewaymodule);
开发者ID:carriercomm,项目名称:WHMCS-Bitcoin-Payment-Module,代码行数:31,代码来源:bitcoin.php

示例12: GetHalvings

<?php

require_once 'jsonRPCClient.php';
$litecoin = new jsonRPCClient('http://user:pw@127.0.0.1:9332/');
try {
    $info = $litecoin->getinfo();
} catch (Exception $e) {
    echo nl2br($e->getMessage()) . '<br />' . "\n";
    die;
}
// Litecoin settings
$blockStartingReward = 50;
$blockHalvingSubsidy = 840000;
$blockTargetSpacing = 2.5;
$maxCoins = 84000000;
$blocks = $info['blocks'];
$coins = CalculateTotalCoins($blockStartingReward, $blocks, $blockHalvingSubsidy);
$blocksRemaining = CalculateRemainingBlocks($blocks, $blockHalvingSubsidy);
$blocksPerDay = 60 / $blockTargetSpacing * 24;
$blockHalvingEstimation = $blocksRemaining / $blocksPerDay * 24 * 60 * 60;
$blockString = '+' . $blockHalvingEstimation . ' second';
$blockReward = CalculateRewardPerBlock($blockStartingReward, $blocks, $blockHalvingSubsidy);
$coinsRemaining = $blocksRemaining * $blockReward;
$nextHalvingHeight = $blocks + $blocksRemaining;
$inflationRate = CalculateInflationRate($coins, $blockReward, $blocksPerDay);
$inflationRateNextHalving = CalculateInflationRate(CalculateTotalCoins($blockStartingReward, $nextHalvingHeight, $blockHalvingSubsidy), CalculateRewardPerBlock($blockStartingReward, $nextHalvingHeight, $blockHalvingSubsidy), $blocksPerDay);
$price = 2.92;
// change to dynamic way of getting price
function GetHalvings($blocks, $subsidy)
{
    return (int) ($blocks / $subsidy);
开发者ID:losh11,项目名称:litecoinblockhalf.com,代码行数:31,代码来源:index.php

示例13: jsonRPCClient

 function before_process()
 {
     global $insert_id, $order;
     $address = $order->customer['email_address'] . '-' . tep_create_random_value(32);
     require_once 'bitcoin/jsonRPCClient.php';
     $bitcoin = new jsonRPCClient('http://' . MODULE_PAYMENT_BITCOIN_LOGIN . ':' . MODULE_PAYMENT_BITCOIN_PASSWORD . '@' . MODULE_PAYMENT_BITCOIN_HOST . '/');
     try {
         $bitcoin->getinfo();
     } catch (Exception $e) {
         $confirmation = array('title' => 'Error: Bitcoin server is down.  Please email system administrator regarding your order after confirmation.');
         return $confirmation;
     }
     $address = $bitcoin->getaccountaddress($address);
     $order->info['comments'] .= ' | Payment Address: ' . $address . ' | ';
     return false;
 }
开发者ID:repos-bitcoin,项目名称:oscommerce-bitcoin,代码行数:16,代码来源:bitcoin.php

示例14: timer

<?php

// ABY WALLET
session_start();
include "/var/www/faucet/core/functions.php";
$start = timer();
include "/var/www/faucet/core/config.php";
include_once "/var/www/faucet/core/includes/jsonRPCClient.php";
include "/var/www/faucet/core/address.inc";
include "/var/www/faucet/core/recaptchalib.inc";
include "/var/www/faucet/core/adscaptchalib.inc";
//captha
$publickey = "6LffhPUSAAAAAGTZ_L4aju_mxXDa6hJcV6-M_k2a";
$privatekey = "6LffhPUSAAAAAH4Msa5u8ieP4QcEYC2nlnWtHZws";
// init
$btclient = new jsonRPCClient("http://" . $btclogin["username"] . ':' . $btclogin["password"] . '@' . $btclogin["host"] . ':' . $btclogin["port"]);
$addr = new Address($btclient, $sqlogin);
$derp = $btclient->getinfo();
//$this->PDO_Conn = new PDO("mysql:host={$sqllogin['host']};dbname={$sqllogin['dbname']}", $sqllogin['username'], $sqllogin['password']);
$dbconn = mysql_connect($sqlogin['host'], $sqlogin['username'], $sqlogin['password']);
mysql_select_db($sqlogin['dbname'], $dbconn);
开发者ID:bitonsource,项目名称:applebyte-faucet,代码行数:21,代码来源:wallet.php

示例15: jsonRPCClient

<?php

$path = '/var/www/app';
include $path . '/config.php';
require $path . '/jsonRPCClient.php';
$coin = new jsonRPCClient("{$wallet['protocol']}://{$wallet['user']}:{$wallet['pass']}@{$wallet['host']}:{$wallet['port']}");
$staking = $coin->getstakinginfo();
$info = $coin->getinfo();
$newArray = array("averageweight" => $staking['averageweight'], "totalweight" => $staking['totalweight'], "netstakeweight" => $staking['netstakeweight'], "interest" => $coin->getinterest(), "balance" => $info['balance'], "connections" => $info['connections'], "time" => time());
if (!file_exists($path . '/db/stats.dat')) {
    file_put_contents($path . '/db/stats.dat', serialize(array($newArray)));
} else {
    $array = unserialize(file_get_contents($path . '/db/stats.dat'));
    array_push($array, $newArray);
    file_put_contents($path . '/db/stats.dat', serialize($array));
}
开发者ID:noise23,项目名称:StakeUI,代码行数:16,代码来源:index.php


注:本文中的jsonRPCClient::getinfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。