PHP code example of bennetgallein / bind-php-wrapper

1. Go to this page and download the library: Download bennetgallein/bind-php-wrapper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bennetgallein / bind-php-wrapper example snippets


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

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

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

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
}