blob: 596d9840e5dd980d6ecac70ddeb89106ff046801 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<?php
function gh_api($api) {
$crl = curl_init("https://api.github.com/" . $api);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($crl, CURLINFO_HEADER_OUT, true);
curl_setopt($crl, CURLOPT_POST, false);
curl_setopt($crl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
"Accept: application/json",
"Authorization: token " . json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/admin/credentials.json"), true)["token"],
"User-Agent: UnchainedTech-Admin/0.0.0 (nekostarfan@gmail.com)"
));
$result = curl_exec($crl);
if ($result === false) {
throw new ErrorException("GitHub API unexpectedly interrupted", 214, E_ERROR);
}
return $result;
}
|