add example of API usage

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-10-27 10:56:42 +02:00
parent 3b31cd8432
commit 4efdb0cd66
2 changed files with 230 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
// include FroxlorAPI helper class
require __DIR__ . '/FroxlorAPI.php';
// create object of FroxlorAPI with URL, apikey and apisecret
$fapi = new FroxlorAPI('https://froxlor.your-host.tld/api.php', 'your-api-key', 'your-api-secret');
// send request
$fapi->request('Froxlor.listFunctions');
// check for error
if (! empty($fapi->getLastError())) {
echo "Error: " . $fapi->getLastError();
exit();
}
// get response of request
$request = $fapi->getLastResponse();
// view response data
var_dump($request);