PHP code example of nzldev / domain-whois

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

    

nzldev / domain-whois example snippets




$sld = 'google.com';

$domain = new NzlDev\Whois\Whois($sld);

$whois_answer = $domain->info();

echo $whois_answer;

if ($domain->isAvailable()) {
    echo "Domain is available\n";
} else {
    echo "Domain is registered\n";
}


 = 'facebook.com';

try {
  $domain = new NzlDev\Whois\Whois($sld);
} catch (InvalidArgumentException $e) {
  die($e->getMessage()."\n");
}

if ($domain->isAvailable()) {
  echo "Domain is available\n";
} else {
  echo "Domain is registered\n";
}