/** * Whois function * * @reponse Whois Information */ private function getWhoIs($domain) { $whois = new Whois(); $query = $domain; $result = $whois->lookup($query, true); $info['email'] = null; $info['expires'] = null; $info['expires'] = $result['regrinfo']['domain']['expires']; foreach ($result['rawdata'] as $rawData) { $arr_info = explode(':', $rawData); if (!array_key_exists(1, $arr_info)) { continue; } if (strpos(strtolower($arr_info[0]), 'registrant email') !== false) { $info['email'] = $arr_info[1]; break; } $info['domain'] = $domain; } return $info; }
public function lookup($domain) { $whois = new Whois(); return $whois->lookup($domain, false); }
/** * Check if a wildcard apply to a valid domain detected * * @return boolean true on success, false on failure */ private function checkWildCardApplyToDomain() { if (!count($this->csr_sans)) { return false; } // Internal FQDNs, reserved IP addresses and .local domains are strict forbidden. $whois = new Whois(); $check = true; foreach ($this->csr_sans as $san) { if (in_array('*', explode('.', $san))) { if (strlen($wildcard = strstr($san, '*', true))) { $check = false; break; } $tldextract = tldextract($san); if (strlen($tldextract["domain"]) && strlen($tldextract["tld"])) { $whois_response = $whois->lookup($tldextract["domain"] . '.' . $tldextract["tld"]); if (strtolower($whois_response["regrinfo"]["registered"]) != 'yes') { $check = false; break; } } else { $check = false; break; } } } return $check; }
* You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * @link http://phpwhois.pw * @copyright Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic * @copyright Maintained by David Saez * @copyright Copyright (c) 2014 Dmitry Lukashin */ header('Content-Type: text/html; charset=UTF-8'); if (file_exists(__DIR__ . '/../vendor/autoload.php')) { require_once __DIR__ . '/../vendor/autoload.php'; } use phpWhois\Whois; use phpWhois\Utils; $whois = new Whois(); if (isset($_GET['query'])) { $query = $_GET['query']; if (!empty($_GET['output'])) { $output = $_GET['output']; } else { $output = ''; } // Set to true if you want to allow proxy requests $allowproxy = false; // get faster but less acurate results $whois->deepWhois = empty($_GET['fast']); // To use special whois servers (see README) //$whois->useServer('uk','whois.nic.uk:1043?{hname} {ip} {query}'); //$whois->useServer('au','whois-check.ausregistry.net.au'); $result = $whois->lookup($query);
<?php require '../vendor/autoload.php'; use PhpWhois\Whois; $whois = new Whois('google.com'); echo $whois->lookup();
* This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * @link http://phpwhois.pw * @copyright Copyright (C)1999,2005 easyDNS Technologies Inc. & Mark Jeftovic * @copyright Maintained by David Saez * @copyright Copyright (c) 2014 Dmitry Lukashin */ if (file_exists(__DIR__ . '/../vendor/autoload.php')) { require_once __DIR__ . '/../vendor/autoload.php'; } use phpWhois\Whois; if (!isset($argv[1])) { echo "\nUsage:\n\nphp " . __FILE__ . " domainname.com\n"; exit(1); } $domain = $argv[1]; $whois = new Whois(); $result = $whois->lookup($domain); print_r($result);
/** * @dataProvider domainsProvider */ public function testQtype($type, $domain) { $whois = new Whois(); $this->assertEquals($type, $whois->getQueryType($domain)); }