Skip to content
Snippets Groups Projects
Commit 1884544c authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update docs: add embed infos

parent 2fcc7308
Branches
No related tags found
No related merge requests found
## Show help ## Show help
```text ```text
./src/amcli -h ./amcli -h
IML Appmonitor as CLI client 0.2 IML Appmonitor as CLI client 0.2
This client performs appmonitor checks and puts the results as JSON to stdout. This client performs appmonitor checks and puts the results as JSON to stdout.
......
## Introduction
To embed the cli tool into your web application you need to
* perform the execution of the binary with referencing the ini `<PATH>amcli --ini=<INI-FILE>`
* catch exitcode and output of STDOUT
* check returncode:
* if it is `0` then the excution was successful - we have a result. You can send the JSON after setting the content type as http response header
* if it is `> 0` the response is no JSON syntax. You should send the output that the error is seen in the appm nitor server.
## PHP
This code snippet is for demonstration purposes only. A PHP web app should use the PHP client - see <https://os-docs.iml.unibe.ch/appmonitor/PHP_client/index.html>
```php
<?php
$AMCLI=__DIR__.'/../built_packages/amcli';
$INI=__DIR__.'/../src/simple.ini';
$sCommand="$AMCLI --ini='$INI'";
$aOut=[];
exec($sCommand, $aOut, $iRc);
if($iRc==0){
header('Content-type: application/json');
}else{
echo "Error: occured...\n";
}
echo implode("\n", $aOut);
```
## Requirements ## Requirements
To update and test the command line tool you need To update and test the command line tool you need
* git * git
* a local PHP8 cli. * a local PHP8 cli.
## Prepare environemnt ## Prepare environment
### Get sources ### Get sources
...@@ -22,6 +22,8 @@ You get this initial structure: ...@@ -22,6 +22,8 @@ You get this initial structure:
```txt ```txt
. .
├── build.php ├── build.php
├── examples
└── embed_example.php
├── inc_functions.php ├── inc_functions.php
├── inc_vars.php ├── inc_vars.php
├── installer.php ├── installer.php
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment