Files
thetool/lib/plesk/plesk.php
2024-03-12 20:36:11 +01:00

36 lines
1015 B
PHP

<?php
class Plesk {
private $host;
private $authorization;
public function __construct($host, $authorization) {
$this->host = $host;
$this->authorization = $authorization;
}
public function getAllDomains() {
// Implement code to fetch all configured domains using Plesk API
// You can use cURL or any HTTP client library to make API requests
// Example:
$url = "https://{$this->host}/api/v2/domains";
$headers = array(
"Authorization: {$this->authorization}",
"Content-Type: application/json"
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($curl);
$response = json_decode($response, true);
if (is_array($response)) {
return $response;
} else {
return false;
}
}
}