PHP code example of codecabin / tethered-uptime-php
1. Go to this page and download the library: Download codecabin/tethered-uptime-php 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/ */
$uptime = new TetheredUptime((object) array(
'apikey' => '[APIKEY]',
'monitorId' => 1,
'events' => (object) array(
'sync' => array(
function() {
echo "Sync has been called";
}
)
)
));
$uptime->sync();
$uptime = new TetheredUptime($configuration);
$uptime->listen('status.complete', function($response){
echo "Response was received: <br>";
var_dump($response);
});
$uptime->sync();
$uptime = new TetheredUptime($configuration);
// Create an incident
$response = $uptime->pushIncident("Server issue", "PHP server is experiencing issues, with these details...", "PHP Server", 0);
$uptime = new TetheredUptime($configuration);
// Add a listener
$uptime->listen('ready', function() {
echo "scheduler is running";
});
$uptime = new TetheredUptime($configuration);
$data = (object) array(
"apikey" => $uptime->configuration->apikey
);
// Get notifiers linked to your account
$response = $uptime->get('/notifiers');