aboutsummaryrefslogtreecommitdiff
path: root/includes/stats/apis.php
blob: 5e8d05b4d9eb95581de3df15bcef758aeac89da6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

class API {
    private $keys;

    public function __construct() {
        $this->keys = json_decode(file_get_contents("./credentials.json"), true);
    }

    public function GitHub(string $path) {
        exec("curl -A \"Minteck-Space/0.0.0 (nekostarfan@gmail.com)\" -H \"Authorization: token " . $this->keys["github"] . "\" https://api.github.com/" . $path, $op);
        $result = implode("\n", $op);

        return $result;
    }

    public function Reddit(string $path) {
        exec("curl -A \"Minteck-Space/0.0.0 (nekostarfan@gmail.com)\" https://www.reddit.com/" . $path . ".json", $op);
        $result = implode("\n", $op);

        return $result;
    }
}