
Here is the source code, all commented for easy understanding:
//http://simplehtmldom.sourceforge.net/
include_once('simple_html_dom.php');
//GET HTML FROM ICO.LISK.IO
$html = file_get_html('https://ico.lisk.io/');
//GET CRYPTI AND BITCOIN PRICE
$priceXCR = json_decode(file_get_contents("http://coinmarketcap-nexuist.rhcloud.com/api/xcr/price"), true)["btc"];
$priceBTC = json_decode(file_get_contents("http://coinmarketcap-nexuist.rhcloud.com/api/btc/price"), true)["usd"];
//COUNTER TO KNOW WHICH COIN IS WHICH
$counter = 0;
//SETUP PRICE VARS
$bitcoinICO = 0;
$cryptiICO = 0;
//LOOP THRU ALL SPANS IN ICO.LISK.IO
foreach($html->find('span') as $element)
{
//FILTER FLOATS ONLY
$number = preg_replace("/[^0-9\.]/", "", $element);
if(is_numeric($number))
{
//0=BITCOIN AMOUNT, 1=CRYPTI AMOUNT, 2=SHAPESHIFT AMOUNT
if($counter==0) $bitcoinICO += $number;
else if($counter==1) $cryptiICO += $number;
else if($counter==2) $bitcoinICO += $number;
//INCREASE COUNTER
$counter++;
}
}
//CONVERT CRYPTI AMOUNT TO BTC
$bitcoinICO+=($cryptiICO*$priceXCR);
//CALCULATE LISK PRICE AND CONVERT TO SATOSHI
$liskPriceBTC = ($bitcoinICO/85000000);
$liskPriceBTCRound = round($liskPriceBTC*100000000);
//CONVERT LISK PRICE TO USD AND FORMAT TO 5 DECIMAL PLACES
$liskPriceUSD = number_format((float)($liskPriceBTC*$priceBTC), 5, '.', '');
header("Content-Type: image/png");
//OPEN LISK LOGO
$im = imageCreateFromPng("/var/www/html/lisk/lisk.png");
//DEAL WITH OPACITY
imageAlphaBlending($im, true);
imageSaveAlpha($im, true);
//SETUP TEXT COLOR
$text_color = imagecolorallocate($im, 0, 0, 0);
//ADD TEXT TO LISK LOGO
imagestring($im, 3, 120, 95, "1 Lisk = " . $liskPriceBTCRound . " Satoshi", $text_color);
imagestring($im, 3, 120, 110, "1 Lisk = " . $liskPriceUSD . " USD", $text_color);
//SAVE IMAGE
imagepng($im, "/var/www/html/lisk/lisk_price.png");
//CLEAN BUFFER
imagedestroy($im);
?>
crontab -e
*/10 * * * * /usr/bin/php /var/www/html/lisk/index.php
Awesome! Added it to the OP.