本文整理匯總了PHP中jsonRPCClient::getreceivedbyaddress方法的典型用法代碼示例。如果您正苦於以下問題:PHP jsonRPCClient::getreceivedbyaddress方法的具體用法?PHP jsonRPCClient::getreceivedbyaddress怎麽用?PHP jsonRPCClient::getreceivedbyaddress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jsonRPCClient
的用法示例。
在下文中一共展示了jsonRPCClient::getreceivedbyaddress方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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";
}
}
示例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');
$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";
}
}
示例3: Mandrill
echo "<br>";
include "config.php";
require_once "jsonRPCClient.php";
require_once "./mandrill-api-php/src/Mandrill.php";
//Not required with Composer'
$mandrill = new Mandrill($mandrilApi);
$address = $_GET["address"];
$shippingAddress = $_GET["shippingaddress"];
$total = $_GET["total"];
$productName = $_GET["product"];
$donate = $_GET["donate"];
$done = $_GET["done"];
$name = $_GET["name"];
$email = $_GET["email"];
$bitcoin = new jsonRPCClient("http://{$rpcuser}:{$rpcpass}@{$rpcserver}:{$rpcport}/");
$balance = $bitcoin->getreceivedbyaddress($address, 1);
// 1 confirmations
if ($balance >= $total) {
$confirmed = True;
} else {
$confirmed = False;
}
$int = rand(0, 3);
$loading = array("..|..", ".... / ....", ".... | ....", ".. \\ ..");
$rand_symbol = $loading[$int];
echo "<b>{$rand_symbol}</b><br>";
if ($confirmed == True) {
if ($done == "False") {
$donateLimeCart = $bitcoin->sendtoaddress("LRWxAtmcA4q2Gxn7GkoJQFAgiXUu5LKbCY", (double) $donate);
// Donation
$message = array('text' => "Donation From LimeCart {$donateLimeCart}", 'subject' => "Donation: {$donateLimeCart}", 'from_email' => 'limecart@yoursite.com', 'from_name' => 'limecart', 'to' => array(array('email' => 'scottlindh@gmail.com', 'name' => 'Scottie', 'type' => 'to')));
示例4: jsonRPCClient
<?php
// CRON must be running every minute!
$included = true;
include '../../inc/db-conf.php';
include '../../inc/wallet_driver.php';
$wallet = new jsonRPCClient($driver_login);
include '../../inc/functions.php';
$deposits = mysql_query("SELECT * FROM `deposits`");
while ($dp = mysql_fetch_array($deposits)) {
$received = $wallet->getreceivedbyaddress($dp['address']);
if ($received < 1.0E-8) {
continue;
}
if ($dp['received'] == 1) {
mysql_query("UPDATE `deposits` SET `confirmations`=`confirmations`+1 WHERE `id`={$dp['id']} LIMIT 1");
if (++$dp['confirmations'] == 15) {
mysql_query("UPDATE `players` SET `balance`=`balance`+{$received} WHERE `id`={$dp['player_id']} LIMIT 1");
mysql_query("DELETE FROM `deposits` WHERE `id`={$dp['id']} LIMIT 1");
}
continue;
}
mysql_query("UPDATE `deposits` SET `received`=1,`amount`={$received} WHERE `id`={$dp['id']} LIMIT 1");
}
mysql_query("DELETE FROM `deposits` WHERE `time_generated`<NOW()-INTERVAL 7 DAY");
示例5: catch
$bitcoin->getinfo();
} catch (Exception $e) {
echo 'Error: Bitcoin server is down. Please email system administrator.';
$down = true;
}
if (!$down) {
global $db;
$accounts = $bitcoin->listaccounts();
//print_r($accounts);
$count = 0;
foreach ($accounts as $a => $t) {
//if($a!==''){
$bc = $bitcoin->getaddressesbyaccount($a);
print '<tr><td align="left">' . $a . '</td><td border="1px">';
foreach ($bc as $b) {
$v = $bitcoin->getreceivedbyaddress($b);
print $b . '<br />';
$sql = 'SELECT * FROM ' . TABLE_ORDERS_STATUS_HISTORY . ' AS osh LEFT JOIN ' . TABLE_ORDERS_STATUS . ' AS os ON os.orders_status_id = osh.orders_status_id WHERE os.orders_status_name = "' . Pending . '" AND osh.comments LIKE "%' . $b . '%"';
$result = $db->Execute($sql);
if ($result->RecordCount() > 0) {
while (!$result->EOF) {
$sql = 'SELECT * FROM ' . TABLE_ORDERS . ' LEFT JOIN ' . TABLE_ORDERS_STATUS . ' on orders_status_id WHERE orders_id = ' . $result->fields['orders_id'] . ' AND orders_status = "1"';
$order = $db->Execute($sql);
echo '<a href="' . zen_href_link('orders.php?page=1&oID=' . $result->fields['orders_id'] . '&action=edit', '', 'NONSSL') . '">Order ' . $result->fields['orders_id'] . '</a> | Due ' . $order->fields['order_total'] * $order->fields['currency_value'] . ' BTC | Received ' . $v . ' BTC | ' . $result->fields['orders_status_name'] . '<br />';
$result->MoveNext();
}
}
$count++;
}
print '</td><td>' . $t . 'BTC</td></tr>';
//}