Skip to content

Commit

Permalink
#1 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sridharrajs committed Jan 5, 2016
1 parent 3b77b40 commit 5e16d6b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions WhoisProcessor.php
Expand Up @@ -3,11 +3,23 @@
include_once('phpwhois/whois.main.php');
include_once('phpwhoisutils/whois.utils.php');
$whois = new Whois();
$result = $whois->Lookup($query);
$naked_domain = getNakedDomain($query);
$result = $whois->Lookup($naked_domain);
if (!empty($result['rawdata'])) {
$utils = new utils;
echo $utils->showHTML($result);
} else {
echo implode($whois->Query['errstr'], "<br />\n");
}
echo "<br />\n";
echo "<br />\n";


function getNakedDomain($input)
{
$input = trim($input, '/');
if (!preg_match('#^http(s)?://#', $input)) {
$input = 'http://' . $input;
}
$urlParts = parse_url($input);
return preg_replace('/^www\./', '', $urlParts['host']);
}

0 comments on commit 5e16d6b

Please sign in to comment.