-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
55 lines (40 loc) · 1.44 KB
/
test.php
File metadata and controls
55 lines (40 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
declare(strict_types=1);
error_reporting(E_ALL);
ini_set('display_errors', '1');
echo "Starting test...\n";
require_once __DIR__ . '/vendor/autoload.php';
use ISPConfigMonitoring\ISPConfigClient;
use ISPConfigMonitoring\ISPConfigException;
echo "Autoload OK\n";
// Load configuration
$configFile = __DIR__ . '/config/config.php';
if (!file_exists($configFile)) {
die("Configuration file not found: {$configFile}\n");
}
echo "Config file found\n";
$config = require $configFile;
echo "Config loaded\n";
echo "SOAP URI: " . $config['soap_uri'] . "\n";
echo "Username: " . $config['username'] . "\n";
try {
echo "Creating ISPConfig client...\n";
$ispconfig = new ISPConfigClient($config);
echo "Client created\n";
echo "Attempting login...\n";
$sessionId = $ispconfig->login();
echo "Login successful! Session ID: " . $sessionId . "\n";
echo "Getting websites...\n";
$websites = $ispconfig->getWebsites();
echo "Found " . count($websites) . " websites\n";
if (count($websites) > 0) {
echo "First website: " . json_encode($websites[0]) . "\n";
}
echo "Test completed successfully!\n";
} catch (ISPConfigException $e) {
echo "ISPConfig Error: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
} catch (Exception $e) {
echo "General Error: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
}