schalk (OP)
Newbie
Offline
Activity: 36
Merit: 0
|
|
May 22, 2011, 01:56:01 AM |
|
Bitcoin Class (JSON-RPC Communication)Integrating Bitcoin into your website can be hard at first and rather frustrating, this class was designed to make it easier and to ease confusion. This script simply connect to a Bitcoin Server and then send a command to get the balance of your account. As the title says it is opensource. I paid for a VPS yesterday which is currently being setup, once it is setup I will record a video demonstrating how to integrate Bitcoin into your website (because I love you guys . Link:https://github.com/schalk-b/Simple-Bitcoin-PHPAPI/Methods:https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_listHow to run server:https://en.bitcoin.it/wiki/Running_BitcoinExample:include_once("Bitcoin.php");
$rpcUser = "username"; $rpcPass = "password"; $url = "http://localhost:8332";
// create bitcoin object $bitcoin = new Bitcoin($url, $rpcUser, $rpcPass);
/** * Refer to https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list * for a list of methods */ $balance = $bitcoin->getBalance(); echo("<p>Balance: $balance"); Donations14bBEcMwwnDVXAYR8n2iTk9PTF5wqYLGR2
|
|
|
|
|
|
In order to get the maximum amount of activity points possible, you just need to post once per day on average. Skipping days is OK as long as you maintain the average.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
|
bitfreak!
Legendary
Offline
Activity: 1536
Merit: 1000
electronic [r]evolution
|
|
May 22, 2011, 07:04:32 AM |
|
So I still need to install Bitcoin on the web server?
Is there a public server I can use or something?
I am very new at this whole Bitcoin thing, but I love it too!
|
XCN: CYsvPpb2YuyAib5ay9GJXU8j3nwohbttTz | BTC: 18MWPVJA9mFLPFT3zht5twuNQmZBDzHoWF Cryptonite - 1st mini-blockchain altcoin | BitShop - digital shop script Web Developer - PHP, SQL, JS, AJAX, JSON, XML, RSS, HTML, CSS
|
|
|
schalk (OP)
Newbie
Offline
Activity: 36
Merit: 0
|
|
May 22, 2011, 07:58:31 AM |
|
Yeah bitcoins are so fascinating, take quite a bit to fully understand though. From what I understand you can write a php script that connect to MtGox's API - https://mtgox.com/support/tradeAPIThis however does require you to have a mtgox account with "cash" on it.
|
|
|
|
carlerha
|
|
May 22, 2011, 03:10:08 PM |
|
I don't see exactly what kind of work you did here, you copied the JSON-RPC-PHP class and changed the name of it? I'm sorry if I'm missing something.
|
|
|
|
matt.collier
Member
Offline
Activity: 105
Merit: 10
|
|
May 22, 2011, 03:42:11 PM |
|
This is excellent! I have written a class that includes methods that interface with blockexplorer.com ( http://blockexplorer.com/q). Would these methods be welcome additions to this class?
|
|
|
|
schalk (OP)
Newbie
Offline
Activity: 36
Merit: 0
|
|
May 22, 2011, 07:49:05 PM |
|
Actually I didn't use the JSON-RPC-PHP class at all. I recreated this from scratch, since it is using the same kind of communication it will ofcourse have some similarities. One of the main differences are that this uses cURL instead of fopen and just has a nicer way of handling errors. Also, I know it's not much, but this one is case sensitive, I personally find getBalance() better practice then getbalance(). If you don't prefer this version, by all means do use the JSON-RPC-PHP verison. @Matt: thanks mate. This class has MIT license so anyone can do with it what they want, if I have time I will see if I can develop a open source system like blockexplorer.com using this as a base class. I'm pretty busy at the moment though, still attending school.
|
|
|
|
matt.collier
Member
Offline
Activity: 105
Merit: 10
|
|
May 22, 2011, 08:23:41 PM |
|
Let me ask my question another way?
Are you looking for contributors to the project? And if so, are methods that communicate with the blockexplorer.com API in keeping with the direction you would like to see this project take?
I could see incorporating methods that ease interfacing with any number of bitcoin related APIs (e.g. MTGOX, ClearCoin, BitcoinID)
|
|
|
|
carlerha
|
|
May 23, 2011, 08:18:42 AM |
|
Actually I didn't use the JSON-RPC-PHP class at all. I recreated this from scratch, since it is using the same kind of communication it will ofcourse have some similarities. One of the main differences are that this uses cURL instead of fopen and just has a nicer way of handling errors. Also, I know it's not much, but this one is case sensitive, I personally find getBalance() better practice then getbalance(). If you don't prefer this version, by all means do use the JSON-RPC-PHP verison. I had no intention of mocking you or saying that your php class was not good, it was just me thinking "why re-invent the wheel" etc. But hey, the incentive is great, and perhaps you'll even develop your script to a stage where it's really awesome!
|
|
|
|
zellfaze
Full Member
Offline
Activity: 141
Merit: 101
Security Enthusiast
|
|
May 25, 2011, 08:48:13 PM |
|
I think the idea of using cURL instead of fopen() is a good idea if it means anything.
|
A+, CCENT, CCNA Security Enthusiast PHP Coder
Not that I expect anyone to, but should you like my post, please donate: Donate: 1BRbfqii6Sm9tEUE8A16H7QeDmYFjyBZ7V
|
|
|
|