PHP code example of gemorroj / whordap

1. Go to this page and download the library: Download gemorroj/whordap 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/ */

    

gemorroj / whordap example snippets



use WhoRdap\NetworkClient\NetworkClient;
use WhoRdap\WhoRdap;
use WhoRdap\Response\WhoisDomainRegistrarResponse;
use WhoRdap\Response\WhoisDomainResponse;
use Psr\Log\NullLogger;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;

$logger = new NullLogger();
$cache = new FilesystemAdapter('whordap', 60); // install symfony/cache

$networkClient = new NetworkClient(cache: $cache, logger: $logger);
$whois = new WhoRdap($networkClient);
// $data = $whois->processWhois('ru');
// $data = $whois->processRdap('ru');
// $data = $whois->processWhois('127.0.0.1');
// $data = $whois->processWhois('192.168.0.0/24'); // CIDR
// $data = $whois->processWhois('2001:0db8:85a3:0000:0000:8a2e:0370:7334');
// $data = $whois->processWhois('AS220');
// $data = $whois->processWhois('sirus.su', 'whois.tcinet.ru'); // custom WHOIS server
// $data = $whois->processRdap('sirus.su', 'https://www.nic.ru/rdap'); // custom RDAP server
$data = $whois->processWhois('vk.com');
$actualResponse = $data instanceof WhoisDomainResponse && $data->registrarResponse instanceof WhoisDomainRegistrarResponse ? $data->registrarResponse : $data;
// echo $actualResponse->response;

print_r($data);
/*
WhoRdap\Response\WhoisDomainResponse Object
(
    [response] => Domain Name: VK.COM
   Registry Domain ID: 3206186_DOMAIN_COM-VRSN
   Registrar WHOIS Server: whois.nic.ru
...
    [server] => whois.verisign-grs.com
    [registrarResponse] => WhoRdap\Response\WhoisDomainRegistrarResponse Object
        (
            [response] => Domain Name: VK.COM
Registry Domain ID: 3206186_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.nic.ru
...
            [server] => whois.nic.ru
        )
)
 */
shell
    php bin/rdap-asn-servers-updater.php
    php bin/rdap-ip-servers-updater.php
    php bin/rdap-tld-servers-updater.php
    php bin/whois-asn-servers-updater.php
    php bin/whois-ip-servers-updater.php
    php bin/whois-tld-servers-updater.php