1. Go to this page and download the library: Download clue/mdns-react 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/ */
$resolver->resolve($hostname)->then(
function ($ip) {
// IP successfully resolved
},
function (Exception $e) {
// an error occurred while looking up the given hostname
}
});
lue\React\Block;
$factory = new Clue\React\Mdns\Factory();
$resolver = $factory->createResolver();
$promise = $resolver->resolve('me.local');
try {
$ip = Block\await($promise, $loop);
// IP successfully resolved
} catch (Exception $e) {
// an error occurred while performing the request
}