1. Go to this page and download the library: Download niko9911/phpwhois 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/ */
niko9911 / phpwhois example snippets
$whois = new \phpWhois\Whois('google.com');
try {
$response = $whois->lookup();
} catch (Exception $e) {
echo 'Error: '.$e->getMessage();
}
if (is_null($response)) {
exit('Can\'t get information about this address');
}
$responseIana = $whois->getResponseIana(); // Response from whois.iana.org
// It provides the whois server for TLD in `refer` and `whois` fields
$responseIanaWhois = $whois->getResponseIanaWhois(); // Response from whois server provided by IANA
$response = $whois->getResponse(); // Response from the whois server specified by library or by user.
// Returned with $whois->lookup()
// If no special whois server was set - this is a copy of `$whois->responseIanaWhois`