Update high
This commit is contained in:
41
TeaSpeak/servers/teamspeak/lib/TSDNS.php
Normal file
41
TeaSpeak/servers/teamspeak/lib/TSDNS.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class TSDNS {
|
||||
|
||||
protected $url = null;
|
||||
protected $apiKey = null;
|
||||
|
||||
function __construct($url, $apiKey) {
|
||||
$this->url = $url;
|
||||
$this->apiKey = $apiKey;
|
||||
}
|
||||
|
||||
function getZones() {
|
||||
$command = '/list';
|
||||
return $this->sendRequest($command);
|
||||
}
|
||||
|
||||
function addZone($zone, $target) {
|
||||
$command = '/add/' . $zone . '/' . $target;
|
||||
return $this->sendRequest($command);
|
||||
}
|
||||
|
||||
function deleteZone($zone) {
|
||||
$command = '/del/' . $zone;
|
||||
return $this->sendRequest($command);
|
||||
}
|
||||
|
||||
function getZone($zone) {
|
||||
$command = '/get/' . $zone;
|
||||
return $this->sendRequest($command);
|
||||
}
|
||||
|
||||
function sendRequest($command) {
|
||||
$url = $this->url . $command;
|
||||
$headers = array('Accept' => 'application/json', 'Authorization' => $this->apiKey);
|
||||
Requests::register_autoloader();
|
||||
$request = Requests::get($url, $headers);
|
||||
return $request;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user