Skip to content

Instantly share code, notes, and snippets.

@GeertJohan
Created October 11, 2015 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeertJohan/4c3883b9d165279b30ab to your computer and use it in GitHub Desktop.
Save GeertJohan/4c3883b9d165279b30ab to your computer and use it in GitHub Desktop.
<?php
echo '<div class="seeds">';
$json = file_get_contents('https://seeds.gulden.com/service/seedsOverview');
$data = json_decode($json, true);
for( $data['nodes'] as $node ) {
$versionMajor = round(substr($node['version'], 0, len($node['version'])-6));
$versionMinor = round(substr($node['version'], len($node['version'])-6), len($node['version'])-4));
$versionPatch = round(substr($node['version'], len($node['version'])-4), len($node['version'])-2));
$versionBuild = round(substr($node['version'], len($node['version'])-2), len($node['version'])));
$version = $versionMajor.'.'.$versionMinor.'.'.$versionPatch;
if($versionBuild != 0) {
$version .= '.'.$versionBuild;
}
echo '
<div class="seeds-row">
<div class="seeds-status seeds-status-'.$node['status'].'">'.$node['status'].'</div>
<div class="seeds-hostname">'.$node['hostname'].'</div>
<div class="seeds-version">'.$version.'</div>
<div class="seeds-connections">'.$node['connections'].'</div>
<div class="seeds-hashrate">'.$node['hashrate'].'</div>
<div class="seeds-difficulty">'.$node['difficulty'].'</div>
<div class="seeds-height">
<a href="https://explorer.gulden.com/#/block/'.$node['blockHash'].'" target="_blank">'.$node['blockNumber'].'</a>
</div>
<div class="seeds-blockHash">
<span style="font-family:monospace;" >'.substr($node['blockHash'], 0, 15).'</span>
</div>
</div>';
}
echo '</div>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment