add example of API usage
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
22
doc/example/list_functions.php
Normal file
22
doc/example/list_functions.php
Normal 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);
|
||||
Reference in New Issue
Block a user