File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,21 @@ as defined in [RFC 6763](https://tools.ietf.org/html/rfc6763).
34
34
Once [ installed] ( #install ) , you can use the following code to look up the address of a local domain name:
35
35
36
36
``` php
37
- $factory = new Factory();
37
+ <?php
38
+
39
+ require __DIR__ . '/vendor/autoload.php';
40
+
41
+ $factory = new Clue\React\Mdns\Factory();
38
42
$resolver = $factory->createResolver();
39
43
40
44
$resolver->lookup('hostname.local')->then(function ($ip) {
41
45
echo 'Found: ' . $ip . PHP_EOL;
46
+ }, function (Exception $e) {
47
+ echo 'Error: ' . $e->getMessage() . PHP_EOL;
42
48
});
43
49
```
44
50
45
- See also the [ examples] ( examples ) .
51
+ See also the [ examples] ( examples/ ) .
46
52
47
53
## Usage
48
54
@@ -105,9 +111,13 @@ you should look into also using [clue/reactphp-block](https://github.com/clue/re
105
111
The resulting blocking code could look something like this:
106
112
107
113
``` php
114
+ <?php
115
+
116
+ require __DIR__ . '/vendor/autoload.php';
117
+
108
118
use Clue\React\Block;
109
119
110
- $factory = new Factory();
120
+ $factory = new Clue\React\Mdns\ Factory();
111
121
$resolver = $factory->createResolver();
112
122
113
123
$promise = $resolver->lookup('me.local');
You can’t perform that action at this time.
0 commit comments