PHP code example of frankvanhest / dns-lookup

1. Go to this page and download the library: Download frankvanhest/dns-lookup 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/ */

    

frankvanhest / dns-lookup example snippets


/** @var \FrankVanHest\DnsLookup\DnsRecord $dnsRecord */
foreach ($dnsLookup->getAllRecords() as $dnsRecord) {
    echo $dnsRecord->getName();
    echo $dnsRecord->getType();
    echo $dnsRecord->getValue();
    echo $dnsRecord->getTtl();
    echo $dnsRecord->getPrio();
}

/** @var \FrankVanHest\DnsLookup\DnsRecord $dnsRecord */
foreach ($dnsLookup->getRecordsByType('A') as $dnsRecord) {
    echo $dnsRecord->getName();
    echo $dnsRecord->getType();
    echo $dnsRecord->getValue();
    echo $dnsRecord->getTtl();
    echo $dnsRecord->getPrio();
}