summaryrefslogtreecommitdiff
path: root/includes/refresh.php
blob: c29136ff380622674b0d5b131d63c9cf1d6e33b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
]));