php-mpos/public/include/pages/api/getdifficulty.inc.php
Sebastian Grewe d4331ed8dc Adding more actions for API page
* getblockcount
* getblocksfound (with limit support)
* getcurrentworkers
* getdifficulty
* getestimatedtime
* getpoolhashrate
* getpoolsharerate
* gettimesincelastblock
2013-05-28 10:50:16 +02:00

26 lines
556 B
PHP

<?php
// Make sure we are called from index.php
if (!defined('SECURITY'))
die('Hacking attempt');
// Check user token
$user->checkApiKey($_REQUEST['api_key']);
// Fetch data from litecoind
if ($bitcoin->can_connect() === true){
if (!$dDifficulty = $memcache->get('dDifficulty')) {
$memcache->set('dDifficulty', $dDifficulty);
$dDifficulty = $bitcoin->query('getdifficulty');
}
} else {
$iDifficulty = 1;
}
// Output JSON format
echo json_encode(array('getdifficulty' => $dDifficulty));
// Supress master template
$supress_master = 1;
?>