php-mpos/public/include/pages/api/getpoolhashrate.inc.php
Sebastian Grewe e6ab8006d1 [FEATURE] Adding more to gauges, adding graph to dashboard
* Adding live-updates for gauges
* Adding new API calls
* Updated statistics to allow custom intervals
* Disabled caching for API calls for now
* Added new hashrate graph with auto-update

Addresses #444
2013-09-14 14:43:14 +02:00

27 lines
613 B
PHP

<?php
// Make sure we are called from index.php
if (!defined('SECURITY')) die('Hacking attempt');
// Check if the API is activated
$api->isActive();
// Check user token
$id = $user->checkApiKey($_REQUEST['api_key']);
// Output JSON format
$statistics->setGetCache(false);
$start = microtime(true);
$dPoolHashrate = $statistics->getCurrentHashrate(300);
$end = microtime(true);
$runtime = ($end - $start) * 1000;
$statistics->setGetCache(true);
echo json_encode(array('getpoolhashrate' => array(
'runtime' => $runtime,
'hashrate' => $dPoolHashrate,
)));
// Supress master template
$supress_master = 1;
?>