PHP code example of panopta / php-panopta-api-client

1. Go to this page and download the library: Download panopta/php-panopta-api-client 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/ */

    

panopta / php-panopta-api-client example snippets




$client = Panopta\ApiClient(
    'https://api2.panopta.com',
    'your-api-token',
    2, // API version
    Panopta\ApiClient::LOG_DEBUG,
    'logs/' // Log directory
);

$fiveContacts = $client->get('/contact', ['limit' => 5]);

$serversWithACertainFullyQualifiedDomainName = $client->get(
    '/server',
    ['fqdn' => 'panopta.com']
);

$serverFortyTwo = $client->get('/server/42');

$newNotificationSchedule = $client->post(
    '/notification_schedule',
    ['name' => 'New Notification Schedule', 'targets' => [$serverFortyTwo['url']]]
);

$updatedServerGroup = $client->put(
    '/server_group',
    [
        'name' => 'Updated Server Group',
        'notification_schedule' => $newNotificationSchedule['url']
    ]
);

$client->delete('/contact/1');