bennetgallein/bind-php-wrapper

该软件包的最新版本(v0.1)没有可用的许可信息。

将PythonAPI绑定到PHP的包装器

v0.1 2018-10-02 13:55 UTC

This package is auto-updated.

Last update: 2024-09-17 00:03:29 UTC


README

这是一个PHP库,用于与Python REST API通信,该API用于BIND DNS服务器。

安装

composer require bennetgallein/bind-php-wrapper

入门

此库需要正确设置并启用Python API。如果是这种情况,请按照以下说明操作

创建新的BIND实例

$bind = new BIND("192.168.1.104", 5000, false);

参数

  • IP(无默认值)
  • 端口(默认:5000)
  • HTTPS(默认:false)重要提示:仅在安全本地环境中使用http。否则,使用反向代理是最佳选择!

列出区域的全部记录

$a = $bind->getZone("gallein2.de");

这返回一个新的Zone对象

$a->getDomain(); // returns the Domains name
$a->getRecords(); // returns an array of Record-Objects

Record对象

foreach ($a->getRecords() as $record) {
    echo $record->getName(); // The name, like '@', 'wwww', 'test', 'test2', ...
    echo $record->getAnswer(); // the response the DNS Server will give
    echo $record->getRecordType(); // the Record Type, like 'A', 'AAAA', 'MX', ...
    echo $record->getTTL(); // The TTL (Time To Live) of the Entry.
}

更新/设置记录

$res = $bind->addRecord("gallein2.de", "86400", "A", "192.168.1.1");
if ($res) {
    // yeah, success
} else {
    // no success
}

删除记录

$res = bind->deleteRecord("gallein2.de", "86400", "A", "192.168.1.1");
if ($res) {
    // yeah, success
} else {
    // no success
}

贡献和问题都是开放的