PHP code example of carlosafonso / php-dns-client
1. Go to this page and download the library: Download carlosafonso/php-dns-client 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/ */
carlosafonso / php-dns-client example snippets
bash
$ composer
php
lient = new Afonso\Dns\Client();
// Let's make an A request for example.com
$request = new Afonso\Dns\Request('google.com', Afonso\Dns\ResourceRecord::TYPE_A);
// Let's send it to name server 8.8.8.8
$response = $client->query($request, '8.8.8.8');
$response->getResourceRecords()[0]; // Instance of AResourceRecord
$response->getResourceRecords()[0]->__toString(); // "216.58.211.238"