PHP code example of hoa / dns

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

    

hoa / dns example snippets


$dns = new Hoa\Dns\Resolver(
    new Hoa\Socket\Server('udp://127.0.0.1:57005')
);
$dns->on('query', function (Hoa\Event\Bucket $bucket) {
    $data = $bucket->getData();

    echo
        'Resolving domain ', $data['domain'],
        ' of type ', $data['type'], "\n";

    return '127.0.0.1';
});
$dns->run();
sh
$ php Resolver.php