Bitcoin Forum
November 11, 2024, 06:46:57 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PHP - Display all transactions to address  (Read 998 times)
joeyjoe (OP)
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
August 23, 2011, 04:16:14 PM
 #1

Im just trying to display all the transactions in a table that were sent to the account called "1"

just like bitcoinduit does it:

http://bitcoinduit.com/Klondike_Gold_Rush

Bitcoin PHP programmer for hire! (HTML / CSS / JQuery / AJAX / .NET).
vv01f
Sr. Member
****
Offline Offline

Activity: 314
Merit: 250


View Profile
August 23, 2011, 06:24:13 PM
Last edit: August 23, 2011, 08:51:46 PM by vv01f
 #2

We now know what you wanna achieve, but we cannot exactly know which ways you have been going already to implement btc with your php-host.
Probably you can post some more information how you connect to daemon and if you get any other information from it already or you still lack the connection..

but if you simply are interested, the wiki gives - at least for my contiguous - enough info: https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#PHP

the method to call is listreceivedbyaccount or listreceivedbyaddress (as you know the exact address when you know the acc) as you can read here: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list#Full_list

donations to me please send via bitcoin 1vvo1FDwSAwNdLVA1mFkM7v76XPZAAUfb
a good European exchange: bitcoin.de (ref-link)
joeyjoe (OP)
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
August 24, 2011, 12:32:20 PM
 #3

Thanks. I managed to work out how to do it. The problem i had is that it would output it in raw data, but i needed to output into an array. a simple bit of php code i was overlooking.

I have managed to do this now, but confused as to why i cannot list the senders address with the transactions

Bitcoin PHP programmer for hire! (HTML / CSS / JQuery / AJAX / .NET).
Anonymous
Guest

August 28, 2011, 01:13:14 AM
Last edit: August 28, 2011, 03:13:15 AM by macintosh264
 #4

Im just trying to display all the transactions in a table that were sent to the account called "1"

just like bitcoinduit does it:

http://bitcoinduit.com/Klondike_Gold_Rush
Sorry, but this was too tempting. I wrote an entire script when I saw this problem and I have to show it off!
Code:
<?php
//Create $jsonRPCClient
$transactions $jsonRPCClient->listtransactions('1',100000000); // the 100000000000 is the max transactions listed. The default is ten, so we set this to a really high number to make sure we list as many transactions as we can
$info $jsonRPCClient->getInfo();
$fee $info["paytxfee"];
$table "<table id=\"transactions\"><tr><th>Txn ID</th><th>To Address</th><th>Value</th></tr>";
foreach (
$txn in $transactions) {
$id $txn["txid"];
$link "http://blockexplorer.com/tx/$id";
$id substr($id,5) . '...';
$address $txn["address"];
$value $txn["amount"]+($txn["amount"] < $fee 0);
$table .= "<tr><td><a href=\"$link\">$id</a></td><td>$address</td><td>$value</td></tr";
}
$table .= "</table>";
echo 
$table
?>

I can write an entire script that does styling and so on, with more detail, and other formatting for .5BTC if you want (if you don't have a script already)
helloworld
Sr. Member
****
Offline Offline

Activity: 266
Merit: 250



View Profile
August 28, 2011, 01:43:50 AM
 #5

There is a typo in the above code:

$jsonRPCClient->listtsansactions(
Anonymous
Guest

August 28, 2011, 03:13:24 AM
 #6

There is a typo in the above code:

$jsonRPCClient->listtsansactions(


Thanks, fixed
joeyjoe (OP)
Full Member
***
Offline Offline

Activity: 224
Merit: 100


View Profile
August 28, 2011, 03:24:29 AM
 #7

Thanks for your input, i managed to do everything i needed. www.interbitlotto.com - I do do PHP just not with bitcoin, but pretty much figured it out now Smiley

thanks anyway

Bitcoin PHP programmer for hire! (HTML / CSS / JQuery / AJAX / .NET).
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!