1. Go to this page and download the library: Download datingvip/php-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/ */
use Iodev\Whois\Factory;
use Iodev\Whois\Exceptions\ConnectionException;
use Iodev\Whois\Exceptions\ServerMismatchException;
use Iodev\Whois\Exceptions\WhoisException;
try {
$whois = Factory::get()->createWhois();
$info = $whois->loadDomainInfo("google.com");
if (!$info) {
print "Null if domain available";
exit;
}
print $info->domainName . " expires at: " . date("d.m.Y H:i:s", $info->expirationDate);
} catch (ConnectionException $e) {
print "Disconnect or connection timeout";
} catch (ServerMismatchException $e) {
print "TLD server (.com for google.com) not found in current server hosts";
} catch (WhoisException $e) {
print "Whois server responded with error '{$e->getMessage()}'";
}
use Iodev\Whois\Loaders\CurlLoader;
use Iodev\Whois\Factory;
$loader = new CurlLoader();
$loader->replaceOptions([
CURLOPT_PROXYTYPE => CURLPROXY_SOCKS5,
CURLOPT_PROXY => "127.0.0.1:1080",
//CURLOPT_PROXYUSERPWD => "user:pass",
]);
$whois = Factory::get()->createWhois($loader);
var_dump([
'ya.ru' => $whois->loadDomainInfo('ya.ru'),
'google.de' => $whois->loadDomainInfo('google.de'),
]);
use Iodev\Whois\Factory;
use Iodev\Whois\Modules\Tld\TldServer;
$whois = Factory::get()->createWhois();
// Define custom whois host
$customServer = new TldServer(".custom", "whois.nic.custom", false, Factory::get()->createTldParser());
// Or define the same via assoc way
$customServer = TldServer::fromData([
"zone" => ".custom",
"host" => "whois.nic.custom",
]);
// Add custom server to existing whois instance
$whois->getTldModule()->addServers([$customServer]);
// Now it can be utilized
$info = $whois->loadDomainInfo("google.custom");
var_dump($info);
use Iodev\Whois\Factory;
use Iodev\Whois\Loaders\SocketLoader;
use Iodev\Whois\Loaders\MemcachedLoader;
$m = new Memcached();
$m->addServer('127.0.0.1', 11211);
$loader = new MemcachedLoader(new SocketLoader(), $m);
$whois = Factory::get()->createWhois($loader);
// do something...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.