PHP code example of phergie / phergie-irc-plugin-dns
1. Go to this page and download the library: Download phergie/phergie-irc-plugin-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/ */
phergie / phergie-irc-plugin-dns example snippets
new \Phergie\Plugin\Dns\Plugin([
// All configuration is optional
'dnsServer' => '1.2.3.4', // IP address of a DNS server, defaults to Google's 8.8.8.8
// or
'command' => 'customDns', // command name, defaults to dns
// or
'resolver' => new React\Dns\Resolver\Resolver(), // provide your own Resolver instance
// defaults to null and is set at first use
// (don't use this unless you know what you are doing!)
// or
'enableCommand' => false, // enable use access to the dns command
])
$this->emitter->emit('dns.resolve', [function($promise) use ($callback, $that) {
$promise->then(function($ip) {
echo 'IP for github.com: ' . $ip . PHP_EOL;
});
}]);
$this->emitter->emit('dns.resolver', [function($resolver) use ($callback, $that) {
$resolver->resolve('github.com')->then(function($ip) {
echo 'IP for github.com: ' . $ip . PHP_EOL;
});
}]);