<?php require_once __DIR__ . '/../vendor/autoload.php'; require_once __DIR__ . '/ClashAPI/API.class.php'; date_default_timezone_set('Europe/Berlin'); $redis = new Predis\Client(getenv('REDIS_URL')); $wl = new CoC_Warlog("#QVQRYYG"); $logcount = 1; foreach ($wl->getItems() as $warlog) { $log = new CoC_Warlog($warlog); $wars[$logcount] = ["result" => $log->getResult(), "endtime" => $log->getEndtime(), "size" => $log->getTeamsize(), "ctag" => $log->getClanTag(), "cname" => $log->getClanName(), "clvl" => $log->getClanLevel(), "cattacks" => $log->getClanAttacks(), "cstars" => $log->getClanStars(), "cdestruct" => number_format($log->getClanDestruction(), 2), "cexp" => $log->getClanExp(), "cbadgesm" => $log->getClanBadgeUrl("small"), "cbadgemd" => $log->getClanBadgeUrl("medium"), "cbadgelg" => $log->getClanBadgeUrl("large"), "otag" => $log->getOpponentTag(), "oname" => $log->getOpponentName(), "olvl" => $log->getOpponentLevel(), "oattacks" => $log->getOpponentAttacks(), "ostars" => $log->getOpponentStars(), "odestruct" => number_format($log->getOpponentDestruction(), 2), "oexp" => $log->getOpponentExp(), "obadgesm" => $log->getOpponentBadgeUrl("small"), "obadgemd" => $log->getOpponentBadgeUrl("medium"), "obadgelg" => $log->getOpponentBadgeUrl("large")]; $logcount++; } $redis->set('warlog', serialize($wars));
<?php require_once "./ClashAPI/API.class.php"; $api = new ClashOfClans(); if ($api->isWarlogPublic("#22UCCU0J")) { $warlog = new CoC_Warlog($api->getWarlog("#22UCCU0J", array("limit" => 10))); for ($i = 0; $i < $warlog->getLogEntryAmount(); $i++) { $logEntry = new CoC_LogEntry($warlog->getLogEntryByIndex($i)); if ($logEntry->getResult() == "win") { echo '<font color="green">'; } else { if ($logEntry->getResult() == "lose") { echo '<font color="red">'; } else { if ($logEntry->getResult() == "draw") { echo '<font color="black">'; } } } echo $logEntry->getClanName() . " " . $logEntry->getClanStars() . " - " . $logEntry->getOpponentStars() . " " . $logEntry->getOpponentName() . " </font><br/>"; } } else { echo "This clan's warlog isn't public, sorry."; }