-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget.php
More file actions
33 lines (25 loc) · 833 Bytes
/
get.php
File metadata and controls
33 lines (25 loc) · 833 Bytes
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
<?php
/**
* Code example for getting a list of clients
*/
include '../vendor/autoload.php';
use Gotify\Exception\GotifyException;
use Gotify\Exception\EndpointException;
try {
// Set server
$server = new Gotify\Server('http://gotify.example.com/');
// Set client token
$auth = new Gotify\Auth\Token('TokenHere');
// Create Client class instance
$client = new Gotify\Endpoint\Client($server, $auth);
$clients = $client->getAll();
foreach ($clients->clients as $details) {
echo 'Id: ' . $details->id . PHP_EOL;
echo 'Name: ' . $details->name . PHP_EOL;
echo 'Token: ' . $details->token . PHP_EOL;
echo 'Last used: ' . $details->lastUsed . PHP_EOL;
echo PHP_EOL;
}
} catch (EndpointException | GotifyException $err) {
echo $err->getMessage();
}