Bitcoin Forum
May 10, 2024, 12:55:12 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: total received counter for donations  (Read 2259 times)
jtimon (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1002


View Profile WWW
April 23, 2011, 03:43:26 PM
 #1

Is there some javascript or something that you can add to your web and contains the following?

-bitcoin address to send donations
-Total amount of bitcoins sent to that address (It doesn't matter if they're gone).
-Total amount of bitcoins needed (optional)

I think it could be useful for some projects or pledges.

2 different forms of free-money: Freicoin (free of basic interest because it's perishable), Mutual credit (no interest because it's abundant)
1715345712
Hero Member
*
Offline Offline

Posts: 1715345712

View Profile Personal Message (Offline)

Ignore
1715345712
Reply with quote  #2

1715345712
Report to moderator
1715345712
Hero Member
*
Offline Offline

Posts: 1715345712

View Profile Personal Message (Offline)

Ignore
1715345712
Reply with quote  #2

1715345712
Report to moderator
1715345712
Hero Member
*
Offline Offline

Posts: 1715345712

View Profile Personal Message (Offline)

Ignore
1715345712
Reply with quote  #2

1715345712
Report to moderator
The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Alex Beckenham
Full Member
***
Offline Offline

Activity: 154
Merit: 100


View Profile
April 23, 2011, 03:52:36 PM
 #2

Can you run PHP on the same site?

jtimon (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1002


View Profile WWW
April 23, 2011, 03:57:43 PM
 #3

I don't have a site. Just asking. Is there something like that for php?

2 different forms of free-money: Freicoin (free of basic interest because it's perishable), Mutual credit (no interest because it's abundant)
Alex Beckenham
Full Member
***
Offline Offline

Activity: 154
Merit: 100


View Profile
April 23, 2011, 04:12:42 PM
 #4

Well, there is now... sort of.

I just put together this very nasty, barely tested bit of PHP to scrape the blockexplorer site for a given address's total received amount.

Code:
<?php

$donation_address
=$_GET['addr'];

$ch curl_init('http://blockexplorer.com/address/'.$donation_address);
curl_setopt ($chCURLOPT_RETURNTRANSFER1) ;
$html curl_exec($ch);
$html=substr($html,strpos($html,'Received BTC:')+14);
$btc=substr($html,0,strpos($html,'</li>'));

echo 
$btc;

die();

?>


If you save that on your site as totalbtc.php and give it an address like this:

totalbtc.php?addr=fivjiwejefijwiejwiejiwei

Then it will output the total received of that address.

As I said though, the above is downright crap code, just put together in the last few minutes... version 0.0.00.1a

Thought it might help get the ball rolling for other people's ideas anyway.


jtimon (OP)
Legendary
*
Offline Offline

Activity: 1372
Merit: 1002


View Profile WWW
April 23, 2011, 04:23:08 PM
 #5

Cool. It seems easier than I thought.

2 different forms of free-money: Freicoin (free of basic interest because it's perishable), Mutual credit (no interest because it's abundant)
Alex Beckenham
Full Member
***
Offline Offline

Activity: 154
Merit: 100


View Profile
April 23, 2011, 04:29:52 PM
 #6

Forgot the disclaimer:

The above code is for example purposes only. It may contain huge security flaws and may cause your server to physically explode.


Anyway,  if noone else has a shot at it, I'll try to rewrite it at some point, and add some javascript/ajax to the mix.

It's a cool idea for a widget anyway, cheers.


theymos
Administrator
Legendary
*
Offline Offline

Activity: 5194
Merit: 12982


View Profile
April 24, 2011, 02:34:17 AM
 #7

There's an API page for that:
http://blockexplorer.com/q/getreceivedbyaddress

I don't recommend scraping the HTML pages.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Alex Beckenham
Full Member
***
Offline Offline

Activity: 154
Merit: 100


View Profile
April 24, 2011, 02:46:34 AM
 #8

There's an API page for that:
http://blockexplorer.com/q/getreceivedbyaddress

I don't recommend scraping the HTML pages.

Neither do I.

Thanks for the API link; I searched Google unsuccessfully for blockexplorer API but that's as far as I went.

Update:

Code:
<?php

$donation_address
=$_GET['addr'];

$ch curl_init('http://blockexplorer.com/q/getreceivedbyaddress/'.$donation_address);
curl_setopt ($chCURLOPT_RETURNTRANSFER1) ;
$btc curl_exec($ch);

echo 
$btc;

die();

?>

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!