@@ -15,15 +15,15 @@ factory. All you need to give it is a nameserver, then you can start resolving
1515names, baby!
1616
1717``` php
18- $loop = React\EventLoop\Factory::create();
19- $factory = new React\Dns\Resolver\Factory();
20- $dns = $factory->create('8.8.8.8', $loop);
21-
22- $dns->resolve('igor.io')->then(function ($ip) {
23- echo "Host: $ip\n";
24- });
25-
26- $loop->run();
18+ $loop = React\EventLoop\Factory::create();
19+ $factory = new React\Dns\Resolver\Factory();
20+ $dns = $factory->create('8.8.8.8', $loop);
21+
22+ $dns->resolve('igor.io')->then(function ($ip) {
23+ echo "Host: $ip\n";
24+ });
25+
26+ $loop->run();
2727```
2828
2929But there's more.
@@ -33,21 +33,21 @@ But there's more.
3333You can cache results by configuring the resolver to use a ` CachedExecutor ` :
3434
3535``` php
36- $loop = React\EventLoop\Factory::create();
37- $factory = new React\Dns\Resolver\Factory();
38- $dns = $factory->createCached('8.8.8.8', $loop);
36+ $loop = React\EventLoop\Factory::create();
37+ $factory = new React\Dns\Resolver\Factory();
38+ $dns = $factory->createCached('8.8.8.8', $loop);
39+
40+ $dns->resolve('igor.io')->then(function ($ip) {
41+ echo "Host: $ip\n";
42+ });
3943
40- $dns->resolve('igor.io')->then(function ($ip) {
41- echo "Host: $ip\n";
42- });
44+ ...
4345
44- ...
46+ $dns->resolve('igor.io')->then(function ($ip) {
47+ echo "Host: $ip\n";
48+ });
4549
46- $dns->resolve('igor.io')->then(function ($ip) {
47- echo "Host: $ip\n";
48- });
49-
50- $loop->run();
50+ $loop->run();
5151```
5252
5353If the first call returns before the second, only one query will be executed.
0 commit comments