-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
46 lines (37 loc) · 1.04 KB
/
example.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
36
37
38
39
40
41
42
43
44
45
46
<?php
require 'vendor/autoload.php';
//Create instance with your credentials
$aimpanel = new Aimpanel\SDK\Api([
"hostname" => "example.com",
"port" => 3131,
"username" => "admin",
"password" => "mysecretpassword"
]);
//list all Minecraft servers
$mc_servers = $aimpanel->minecraft->list_all();
foreach ($mc_servers as $mc)
{
echo "ID " . $mc->id . ", state: " . $mc->state . PHP_EOL;
}
//Turn on Minecraft server with ID 1
print_r($aimpanel->minecraft->turn_on(1));
//Wait a while
echo "Waiting 5 seconds" . PHP_EOL;
sleep(5);
//list all Minecraft servers again
$mc_servers = $aimpanel->minecraft->list_all();
foreach ($mc_servers as $mc)
{
echo "ID " . $mc->id . ", state: " . $mc->state . PHP_EOL;
}
//Turn off Minecraft server with ID 1
print_r($aimpanel->minecraft->turn_off(1));
//Wait a while
echo "Waiting 5 seconds" . PHP_EOL;
sleep(5);
//list all Minecraft servers once again
$mc_servers = $aimpanel->minecraft->list_all();
foreach ($mc_servers as $mc)
{
echo "ID " . $mc->id . ", state: " . $mc->state . PHP_EOL;
}