//call processorder script $json_url = $strCallbackURL . "?secret={$strSecret}&transaction_hash={$strTransactionID}&address={$strAddress}&input_address={$strAddress}&userid={$strLabel2}&value={$intAmount}&confirms={$intConfirmations}&server=amsterdam"; echo "<br>url: {$json_url} <br>"; $json_data = file_get_contents($json_url); echo "data = {$json_data} <br>"; $json_feed = json_decode($json_data); $strCallbackResponse = $json_data; echo "strCallbackResponse = {$strCallbackResponse} <br>"; } $strTransaction = funct_GetandCleanVariables($_GET['txid']); //$strTransaction = "d3de9c8d5ed75ca9d265f5b4581795d002234246f19dafe4d83b17661a4e3473"; //echo $strTransaction ; if ($strTransaction) { //get transaction info as JSON object, only for local transactions $bitcoin = new jsonRPCClient(JSONRPC_CONNECTIONSTRING_CC); $trxinfo = $bitcoin->gettransaction($strTransaction); $new = "Transaction hash: " . $argv[1] . "\n balance: " . $trxinfo["balance"] . "\n amount: " . $trxinfo["amount"] . "\n confirmations: " . $trxinfo["confirmations"] . "\n blockhash: " . $trxinfo["blockhash"] . "\n blockindex: " . $trxinfo["blockindex"] . "\n blocktime: " . $trxinfo["blocktime"] . "\n txid: " . $trxinfo["txid"] . "\n time: " . $trxinfo["time"] . "\n timereceived: " . $trxinfo["timereceived"] . "\n account: " . $trxinfo["details"][0]["account"] . "\n address: " . $trxinfo["details"][0]["address"] . "\n category: " . $trxinfo["details"][0]["category"] . "\n amount: " . $trxinfo["details"][0]["amount"] . "\n fee: " . $trxinfo["details"][0]["fee"]; // According to https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list, fee is returned, but it doesn't seem that way here echo nl2br($new) . "<br><br><br>"; //if we want the from address and more detail we can get the raw transaction, decode it, extract the values from Json and get more info //Enable txindex=1 in your bitcoin.conf (You'll need to rebuild the database as the transaction index is normally not maintained, start using -reindex to do so), and //use the getrawtransaction call to request information about any transaction $strRawHex = $bitcoin->getrawtransaction($strTransaction); $objJSON = $bitcoin->decoderawtransaction($strRawHex); //print_r($objJSON)."<br><br>"; $trxinfo = $objJSON; $json_string = json_encode($objJSON, JSON_PRETTY_PRINT); //$trxinfo = json_decode($objJSON); //print_r( ($json_string))."<br><br>"; echo "input 1 txid: " . $trxinfo["vin"][0]["txid"] . "<br>"; echo "output 1 amt: " . $trxinfo["vout"][0]["value"] . "<br>";
$obj = ["blockchain" => $blockchain, "address" => "N/A", "txs" => []]; if (isset($_GET['id']) && $_GET['id'] && $_GET['id'] != 'false' && isset($_GET['to']) && $_GET['to'] && $_GET['to'] != 'false') { $valid_txs = []; $address = $_GET['id']; $credit_address = $_GET['to']; $obj['address'] = $address; $account_name = 'XXX_' . $address; $credit_account_name = 'XXX_' . $credit_address; $originaL_txs = $bitcoind->listtransactions($credit_account_name, 1000, 0, true); if ($originaL_txs && is_array($originaL_txs)) { $txs = array_reverse($originaL_txs); foreach ($txs as $key => $tx) { //$txs[$key]['raw'] = $bitcoind->getrawtransaction($tx['txid'], 1); $txs[$key]['tx'] = $bitcoind->getrawtransaction($tx['txid'], 1); foreach ($txs[$key]['tx']['vin'] as $input_key => $input) { $txs[$key]['tx']['vin'][$input_key]['tx'] = $bitcoind->gettransaction($input['txid'], true); foreach ($txs[$key]['tx']['vin'][$input_key]['tx']['details'] as $detail_key => $detail) { if (isset($detail['address']) && $detail['address'] == $obj['address']) { if (!isset($valid_txs['TX_' . $tx['time'] . '_' . $tx['txid']])) { $valid_txs['TX_' . $tx['time'] . '_' . $tx['txid']] = $bitcoind->getrawtransaction($tx['txid'], 1); $valid_txs['TX_' . $tx['time'] . '_' . $tx['txid']]['details'] = $detail; } } } } } $txs = []; foreach ($valid_txs as $tx) { $this_tx = ["txid" => $tx['txid'], "data" => "", "pos" => null, "tot" => count($tx['vout'])]; foreach ($tx['vout'] as $key => $output) { if ($output['value'] <= 0) {