1. Go to this page and download the library: Download amphp/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/ */
amphp / dns example snippets
// Example without type restriction. Will return IPv4 and / or IPv6 addresses.
// What's returned depends on what's available for the given hostname.
/** @var Amp\Dns\DnsRecord[] $records */
$records = Amp\Dns\resolve("github.com");
// Example with type restriction. Will throw an exception if there are no A records.
/** @var Amp\Dns\DnsRecord[] $records */
$records = Amp\Dns\resolve("github.com", Amp\Dns\DnsRecord::A);