PHP code example of carlosio / pingdom
1. Go to this page and download the library: Download carlosio/pingdom 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/ */
carlosio / pingdom example snippets
CarlosIO\Pingdom\Account;
use CarlosIO\Pingdom\Client;
$client = new Client();
$client->addAccount(new Account('<user>', '<password>', '<token>'));
// As an example...
$checks = $client->getChecks();
foreach ($checks as /** @var \CarlosIO\Pingdom\Check $check */ $check) {
echo $check->getName(), ' (', $check->getHostname(), ')', PHP_EOL;
echo $check->getStatus(), ' ', $check->getLastResponseTime(), PHP_EOL;
}
$actions = $client->getActions();
foreach ($actions as /** @var \CarlosIO\Pingdom\Action $action */ $action) {
echo $action->getMessageFull(), ' ', $action->getContactName(), ' ', $action->getVia(), PHP_EOL;
}
$contacts = $client->getContacts();
foreach ($contacts as /** @var \CarlosIO\Pingdom\Contact $contact */ $contact) {
echo $contact->getName(), ' ', $contact->getEmail(), PHP_EOL;
}
$credits = $client->getCredits();
foreach ($credits as /** @var \CarlosIO\Pingdom\Credit $credit */ $credit) {
echo $credit->getAvailableChecks(), PHP_EOL;
}
$probes = $client->getProbes();
foreach ($probes as /** @var \CarlosIO\Pingdom\Probe $probe */ $probe) {
echo $probe->getCountry(), ' ', $probe->getIp(), PHP_EOL;
}
$serverTimes = $client->getServerTime();
foreach ($serverTimes as /** @var \CarlosIO\Pingdom\ServerTime $serverTime */ $serverTime) {
echo $serverTime->getServerTime(), PHP_EOL;
}
bash
curl -s http://getcomposer.org/installer | php
php composer.phar install