forked from Mewnojs/mcapi-pe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.php
More file actions
68 lines (53 loc) · 1.33 KB
/
api.php
File metadata and controls
68 lines (53 loc) · 1.33 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
/*
* MCPEServerPingAPI written by GenesisMiuss
* Version: 1.0.0
* Website: https://miuss.org
* GitHub: https://github.com/miuss/mcapi-pe
*/
header('Content-type:text/json');
$host = $_GET['ip'];
$port = $_GET['port'];
require_once 'ApiQuery.php';
$json = array(
'status' => 'success',
'online' => false,
'host' => array(
'ip' => $host,
'port' => $port
),
'motd' => null,
'version' => array(
'version' => null,
'software' => null,
'plugins' => null
),
'players' => array(
'max' => 0,
'now' => 0,
)
);
if ($Info = $Query->GetInfo()) {
if($Info['GameName']=='MINECRAFTPE'){
$json = array(
'status' => 'success',
'online' => true,
'host' => array(
'ip' => $host,
'port' => $port
),
'motd' => $Info['HostName'],
'version' => array(
'version' => $Info['Version'],
'software' => $Info['Software'],
'plugins' => $Info['Plugins']
),
'players' => array(
'max' => $Info['MaxPlayers'],
'now' => $Info['Players']
)
);
}
}
echo json_encode($json, JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
?>