'local-sample.php', //'EPSYTOUR'=>'epsytour.php', /* copy local.php file and edit target IP:PORT */ ); // 3 seconds max. set_time_limit(3); error_reporting(0); function getdataFromPears() { global $host, $configs; $data = array(); foreach ($configs as $name => $conf) { $json = file_get_contents($host.$conf); $data[$name] = json_decode($json, TRUE); } return $data; } function ignoreField($key) { $ignored = array('API','VER','GPU','CARD','GPUS','CPU'); return in_array($key, $ignored); } function translateField($key) { $intl = array(); $intl['NAME'] = 'Software'; $intl['VER'] = 'Version'; $intl['ALGO'] = 'Algorithm'; $intl['GPUS'] = 'GPUs'; $intl['CPUS'] = 'Threads'; $intl['KHS'] = 'Hash rate (kH/s)'; $intl['ACC'] = 'Accepted shares'; $intl['ACCMN'] = 'Accepted / mn'; $intl['REJ'] = 'Rejected'; $intl['DIFF'] = 'Difficulty'; $intl['UPTIME'] = 'Miner up time'; $intl['TS'] = 'Last update'; $intl['TEMP'] = 'T°c'; $intl['FAN'] = 'Fan %'; $intl['FREQ'] = 'Freq.'; $intl['PST'] = 'P-State'; if (isset($intl[$key])) return $intl[$key]; else return $key; } function translateValue($key,$val,$data=array()) { switch ($key) { case 'UPTIME': $min = floor(intval($val) / 60); $sec = intval($val) % 60; $val = "${min}mn${sec}s"; if ($min > 180) { $hrs = floor($min / 60); $min = $min % 60; $val = "${hrs}h${min}mn"; } break; case 'NAME': $val = $data['NAME'].' '.$data['VER']; break; case 'FREQ': $val = sprintf("%d MHz", round(floatval($val)/1000.0)); break; case 'TS': $val = strftime("%H:%M:%S", (int) $val); break; } return $val; } function displayData($data) { $htm = ''; $totals = array(); foreach ($data as $name => $stats) { $htm .= ''."\n"; $htm .= '\n"; if (!empty($stats)) { $summary = (array) $stats['summary']; foreach ($summary as $key=>$val) { if (!empty($val) && !ignoreField($key)) $htm .= ''. '\n"; } if (isset($summary['KHS'])) @ $totals[$summary['ALGO']] += floatval($summary['KHS']); foreach ($stats['threads'] as $g=>$gpu) { $card = isset($gpu['CARD']) ? $gpu['CARD'] : ''; $htm .= '\n"; foreach ($gpu as $key=>$val) { if (!empty($val) && !ignoreField($key)) $htm .= ''. '\n"; } } } $htm .= "
'.$name."
'.translateField($key).''.translateValue($key, $val, $summary)."
'.$g." $card
'.translateField($key).''.translateValue($key, $val)."
\n"; } // totals if (!empty($totals)) { $htm .= '

Total Hash rate

'."\n"; foreach ($totals as $algo => $hashrate) { $htm .= '
  • '.$algo.":$hashrate kH/s
  • \n"; } $htm .= '
    '; } return $htm; } $data = getdataFromPears(); ?> ccminer rig api sample