summaryrefslogtreecommitdiff
path: root/includes/refresh.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/refresh.php')
-rw-r--r--includes/refresh.php35
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