1. Go to this page and download the library: Download benclerc/sophos-xgapi 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/ */
benclerc / sophos-xgapi example snippets
// Basic configuration
$configFirewall = new \Sophos\Config('123.123.123.123', 'admin', 'password');
// Configuration for very slow firewalls/long requests
$configFirewall = new \Sophos\Config('123.123.123.123', 'admin', 'password');
$configFirewall->setTimeout(20000);
// Unsecure configuration
$configFirewall = new \Sophos\Config('123.123.123.123', 'admin', 'password');
$configFirewall->setSSLVerifyPeer(FALSE)->setSSLVerifyHost(FALSE);
$firewall = new \Sophos\XGAPI($configFirewall);
// All IPHost
$entities = ['IPHost'];
// IPHost named 'IP_TEST'
$entities = [
'IPHost'=>[
['Name', '=', 'IP_TEST']
]
];
// All IPHost with 'IP_' in the name OR of type 'Network'
$entities = [
'IPHost'=>[
['Name', 'like', 'IP_'],
['HostType', '=', 'Network']
]
];
// All IPHost and network interface named LAN
$entities = [
'IPHost',
'Interface'=>[
['Name', '=', 'LAN']
]
];
try {
$result = $firewall->get($entites);
} catch (Exception $e) {
echo('Handle error : '.$e->getMessage());
}