diff options
author | Minteck <contact@minteck.org> | 2022-08-10 00:04:25 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-10 00:04:25 +0200 |
commit | 0417260bf158c5d7b62888dae2e202b0de115a05 (patch) | |
tree | 7f54ee56da118813f2d1b3a324d322d0c74fa51b /includes/refresh.php | |
download | pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.gz pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.bz2 pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.zip |
Initial commit
Diffstat (limited to 'includes/refresh.php')
-rw-r--r-- | includes/refresh.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/includes/refresh.php b/includes/refresh.php new file mode 100644 index 0000000..c29136f --- /dev/null +++ b/includes/refresh.php @@ -0,0 +1,35 @@ +<?php + +$start = time(); +@mkdir("./data"); + +function getSystem(string $id) { + echo("System: $id\n"); + + echo(" Base system info\n"); + file_put_contents("./data/$id-general.json", file_get_contents("https://api.pluralkit.me/v2/systems/$id")); + sleep(1); + + echo(" System members\n"); + file_put_contents("./data/$id-members.json", file_get_contents("https://api.pluralkit.me/v2/systems/$id/members")); + sleep(1); + + echo(" Fronters\n"); + file_put_contents("./data/$id-fronters.json", file_get_contents("https://api.pluralkit.me/v2/systems/$id/fronters")); + sleep(1); + + echo(" Switches\n"); + file_put_contents("./data/$id-switches.json", file_get_contents("https://api.pluralkit.me/v2/systems/$id/switches")); + sleep(1); +} + +getSystem("gdapd"); // Raindrops +getSystem("ynmuc"); // Cloudburst +$time = (time() - $start); + +echo("Completed in " . $time . " seconds.\n"); + +file_put_contents("./data/refresh.json", json_encode([ + "timestamp" => time(), + "duration" => $time +]));
\ No newline at end of file |