-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats-hash.php
35 lines (30 loc) · 869 Bytes
/
stats-hash.php
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
require('functions.php');
$address = upstreamAddress('HASH');
$handle = FALSE;
header("Access-Control-Allow-Origin: *");
header('Content-Type: application/json; charset=utf-8');
if (! isset($_REQUEST['hash'])) {
http_response_code(400);
echo json_encode(
array(
'status' => 'error',
'reason' => "Missing 'hash' param"
)
);
die();
}
$handle = jsonGet($address, json_encode(array('hash' => $_REQUEST['hash'])));
if (! $handle) {
http_response_code(500);
echo json_encode(
array(
'status' => 'error',
'reason' => 'Invalid upstream handle'
)
);
} else {
while(!feof($handle)) {
echo fgets($handle, 1024);
}
}