Beispiel #1
0
 /** 
  * Called whenever someone wants to check current block height.
  *
  * @param object $parent The object that's calling the module
  * @param array  $data   Data
  * @param array  $extra  Extra data such as regexps
  *
  * @return none
  */
 public function getCurrentCount($parent, $data, $extra)
 {
     extract($extra);
     switch ($extra['regexp']['curr']) {
         case 'btc':
             $http = new HttpSession('blockexplorer.com', 80);
             $http->setMaxLength(1024);
             $http->setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
             $http->getPage(array($this, 'outputData'), array_merge($extra, array('curr' => 'BTC')), '/q/getblockcount');
             break;
         case 'ltc':
             $http = new HttpSession('litecoinscout.com', 80);
             $http->setMaxLength(1024);
             $http->setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31');
             $http->getPage(array($this, 'outputData'), array_merge($extra, array('curr' => 'LTC')), '/chain/Litecoin/q/getblockcount');
             break;
     }
 }
Beispiel #2
0
 /**
  * Initiates a mtgox currency conversion
  *
  * @param array  $vars Array with extra stuff
  *
  * @return non
  */
 public function mtgoxCurrency($extra)
 {
     if ($this->cache['btc']['time'] + 120 >= time()) {
         //    return $this->replyMtgox(null,$this->cache['btc']['obj'],$extra);
     }
     $http = new HttpSession('epg.io', 80);
     // Local private sandbox for BTC-E Bitcoin
     $http->setMaxLength(4096);
     $http->setHeader('User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22');
     $http->getPage(array($this, 'replyMtgox'), $extra, '/sandbox/btce');
 }