public function isDomainAvailable(Registrar_Domain $domain) { $this->getLog()->debug('Checking domain availability: ' . $domain->getName()); if ($this->config['use_whois']) { $w = new Whois($domain->getName()); return $w->isAvailable(); } return true; }
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ //include whois class include __DIR__ . '\\src\\Whois.php'; $whois = new \Whois(); $domain = 'google.com'; //get whois info $whois_result = $whois->getInfo($domain); echo $whois_result; //check domain status if ($whois->isAvailable($domain)) { echo "Domain is available\n"; } else { echo "Domain is registered\n"; }
<?php error_reporting(E_ALL); ini_set('display_errors', '1'); require_once "../src/Phois/Whois/Whois.php"; if (isset($_POST['dominio'])) { # code... $sld = $_POST['dominio']; $domain = new Whois($sld); $whois_answer = $domain->info(); echo $whois_answer; if ($domain->isAvailable()) { echo "Domain is available\n"; } else { echo "Domain is registered\n"; } ?> <form action="" method="POST"> <input type="text" name="dominio"> <input type="submit"> </form> <?php } else { ?> <form action="" method="POST"> <input type="text" name="dominio"> <input type="submit"> </form> <?php }