1. Go to this page and download the library: Download emild/dns 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/ */
emild / dns example snippets
use Spatie\Dns\Dns;
$dns = new Dns();
$dns->getRecords('spatie.be'); // returns all available dns records
$dns->getRecords('spatie.be', 'A'); // returns only A records
use Spatie\Dns\Dns;
$dns = new Dns();
$dns->getRecords('spatie.be'); // returns all available dns records
$dns->getRecords('spatie.be', 'A'); // returns only A records
$dns->getRecords('spatie.be', ['A', 'CNAME']); // returns both A and CNAME records
$dns->getRecords('spatie.be', DNS_MX); // returns only MX records
$dns->getRecords('spatie.be', DNS_A | DNS_AAAA); // returns both A and AAAA records
$ARecord = $dns->getRecords('spatie.be', 'A')[0];
(string)$ARecord // returns `spatie.be. 900 IN A 138.197.187.74`
use Spatie\Dns\Dns;
(new Dns)
->useNameserver('ns1.openminds.be') // use ns1.openminds.be
->getRecords('spatie.be');
use \Spatie\Dns\Support\Factory();
// returns instance of \Spatie\Dns\Records\CNAME
(new Factory())->guess('www.spatie.be. 300 IN CNAME spatie.be.');