1
0
mirror of https://github.com/danog/dns.git synced 2024-11-30 04:29:06 +01:00
dns/examples/basic_run.php
Chris Wright d5b5192ba3 Finished initial implementation
zOMG too many things to document
2014-06-15 00:47:15 +01:00

27 lines
499 B
PHP

<?php
use Addr\ResolverFactory,
Alert\ReactorFactory;
require dirname(__DIR__) . '/src/bootstrap.php';
$names = [
'google.com',
'github.com',
'stackoverflow.com',
'localhost',
'192.168.0.1',
'::1',
];
$reactor = (new ReactorFactory)->select();
$resolver = (new ResolverFactory)->createResolver($reactor);
foreach ($names as $name) {
$resolver->resolve($name, function($addr) use($name, $resolver) {
echo "{$name}: {$addr}\n";
});
}
$reactor->run();