Add Domains
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user