From c9a4fabb8dfd7a5e2aa19e474bc267aba4d49d29 Mon Sep 17 00:00:00 2001 From: Lanta Date: Tue, 14 Nov 2023 19:49:42 +0100 Subject: [PATCH] matchinfo --- matchinfo.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 matchinfo.php diff --git a/matchinfo.php b/matchinfo.php new file mode 100644 index 0000000..0a6ee08 --- /dev/null +++ b/matchinfo.php @@ -0,0 +1,38 @@ +"; + echo "Player NameKillsDamage DealtTime SurvivedRank"; + + // Loop through the JSON data to extract player stats + foreach ($jsonData['data']['relationships']['rosters']['data'] as $roster) { + foreach ($jsonData['included'] as $includedItem) { + if ($includedItem['type'] === 'participant' && in_array(['type' => 'participant', 'id' => $includedItem['id']], $roster['relationships']['participants']['data'])) { + $playerStats = $includedItem['attributes']['stats']; + echo ""; + echo "" . htmlspecialchars($playerStats['name']) . ""; + echo "" . htmlspecialchars($playerStats['kills']) . ""; + echo "" . htmlspecialchars($playerStats['damageDealt']) . ""; + echo "" . htmlspecialchars($playerStats['timeSurvived']) . ""; + echo "" . htmlspecialchars($playerStats['winPlace']) . ""; + echo ""; + } + } + } + echo ""; + } else { + echo "JSON file not found for the given match ID."; + } +} else { + echo "No match ID provided."; +} +?>