Bitcoin Forum
December 05, 2016, 08:51:32 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Bitcoin library for PHP (alpha release)  (Read 2354 times)
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



View Profile WWW
November 23, 2010, 08:12:12 PM
 #1

https://github.com/mikegogulski/bitcoin-php

(untested) Drupal usage example:
Code:
  include_once("bitcoin.inc");
  $bitcoin_client = new BitcoinClient($scheme, $username, $password, $hostname, $port, $certificate_path, $debuglevel);
  if (TRUE !== ($fault = $bitcoin_client->can_connect()))
    return watchdog('uc_bitcoin_cron', 'Unable to access Bitcoin server. Fault: !fault', $fault);
  // loop through the open transactions
  while ($my_order = db_fetch_object($result)) {
    // check for transaction completion
    $address = $my_order->bitcoin_address;
    try {
      $paid = $bitcoin_client->query("getreceivedbyaddress", $address, variable_get("uc_bitcoin_transaction_confirms", 1));
    } catch (BitcoinClientException $e) {
      return watchdog('uc_bitcoin', "Bitcoin server communication failed on getreceivedbyaddress !address with fault string !fault", array("!address" => $address, '!fault' => $e . message), WATCHDOG_ALERT);
    }

  • Abstracts away the underlying JSON-RPC interface
  • Incorporates theymos's ports of the address and hash handling functions
  • Includes unit tests

Forks welcome!

FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480927892
Hero Member
*
Offline Offline

Posts: 1480927892

View Profile Personal Message (Offline)

Ignore
1480927892
Reply with quote  #2

1480927892
Report to moderator
1480927892
Hero Member
*
Offline Offline

Posts: 1480927892

View Profile Personal Message (Offline)

Ignore
1480927892
Reply with quote  #2

1480927892
Report to moderator
1480927892
Hero Member
*
Offline Offline

Posts: 1480927892

View Profile Personal Message (Offline)

Ignore
1480927892
Reply with quote  #2

1480927892
Report to moderator
Hiro Protagonist
Newbie
*
Offline Offline

Activity: 3


View Profile
December 30, 2010, 08:14:38 PM
 #2

Hey Mike,

Thanks for the library. I was looking to roll a module for Ubercart to accept Bitcoin this weekend, and you saved me a lot of work. Any updates on your library? Or are there any other modules in the works already to do this?
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



View Profile WWW
December 31, 2010, 12:16:22 AM
 #3

Hello Hiro,

Check around here for uc_bitcoin, which uses the library and is already a working payment method for Ubercart.

I'm a bit behind on keeping the library synced to the latest API version, but that shouldn't be a problem as yet, since the deprecated label functions are still in bitcoin.

Peace,
Mike

FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
fabianhjr
Sr. Member
****
Offline Offline

Activity: 322


Do The Evolution


View Profile
December 31, 2010, 04:02:11 AM
 #4

Hey, by any chance had you seen a PrestaShop module? I am not a great coder and need this to get my shop to accept Bitcoins.

Thanks for the library Mike. Cheesy

mizerydearia
Hero Member
*****
Offline Offline

Activity: 574



View Profile
December 31, 2010, 07:09:05 PM
 #5

Ah, I didn't notice this library before working on my Bitcoin Control Panel project.  Nice job!
dduane
Jr. Member
*
Offline Offline

Activity: 47



View Profile WWW
January 03, 2011, 06:18:45 AM
 #6

Also check out the btc_address module (http://github.com/DarrellDuane/btc_address)  for holding bitcoin addresses.

I've also made a very rough release of the mtgox drupal module for being able to utilize the Mt. Gox Tradiing API.   
http://github.com/DarrellDuane/mtgox

I've just added code the the btc_address to check for the Bitcoin library and provide instructions for downloading it if it isn't downloaded on the Drupal status report.  I'd encourage someone who's working on uc_bitcoin to copy my code and my README.txt and separate the bitcoin.inc library from the uc_bitcoin distribution.   Not sure if Mike wants to do that or perhaps MizeryDearia might want to. 
Hiro Protagonist
Newbie
*
Offline Offline

Activity: 3


View Profile
January 03, 2011, 09:04:15 PM
 #7

Hey, thanks for heads up on uc_bitcoin. I didn't find it in my initial search but found it by name. Thanks!
mikegogulski
Sr. Member
****
Offline Offline

Activity: 360



View Profile WWW
January 21, 2011, 01:05:50 AM
 #8

Pushed an update to Github today to bring this in line with the 0.3.19 API. Some functions lack unit tests, so be warned!

FREE ROSS ULBRICHT, allegedly one of the Dread Pirates Roberts of the Silk Road
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!