PHP code example of xelon-ag / php-api-client-opsgenie
1. Go to this page and download the library: Download xelon-ag/php-api-client-opsgenie library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xelon-ag / php-api-client-opsgenie example snippets
# named constructor to create a client (for EU)
$client = AlertApiClient::createForEUApi(getenv(UPSGENIE_TOKEN));
$alert = new Alert('eazyauction', 'test-alert', 'foo mag bär', 'beer-bar');
$response = $client->createAlert($alert);
if($response->isSuccessful()){
// read our former created alert
$alert = $client->getAlert(new GetAlertRequest($alert->getAlias()));
// close our former created alert
$client->closeAlert(new CloseAlertRequest($alert->getAlias()));
}
$token = "xxx-xxx-xxx";
$client = new HeartbeatApiClient(HttpClient::createForEUApi(getenv(UPSGENIE_TOKEN)));
do {
$result = $client->sendPing(new PingRequest('beat'));
var_dump($result, $result->isSuccessful());
sleep(60);
} while(true);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.