Rev 5 | Go to most recent revision | Blame | Last modification | View Log | RSS feed
#!/usr/bin/php
<?php
#
# VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
# Subprogram: vu TLD whois
#
# (c) 2014 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
#
# License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
#
/*
Official whois server is: vunic.vu
But the page http://www.vunic.vu/whoiss/whois.php
contains following additional information:
- Date modified
- Registrar
*/
require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php';
$domain = isset($argv[1]) ? $argv[1] : '';
if (preg_match('@(.*)((|\.com|\.edu|\.net|\.org)(\.vu))@isU', $domain, $m)) {
$domain_wotld = $m[1];
$tld = $m[2];
} else {
echo "'$domain' is not a valid .vu domain.\n";
exit(2);
}
$url = 'http://www.vunic.vu/whoiss/process_whois.php';
$post = 'domain='.rawurlencode($domain_wotld).'&ext='.rawurlencode($tld);
$cont = file_get_contents2($url, $post);
$cont = str_replace('</tr>', "\n", $cont);
$cont = html_entity_decode(strip_tags($cont));
// Remove whitespaces at the beginning of each line
$cont = preg_replace('@([\r\n])[ \t]+(\S)@isU', '\\1\\2', $cont);
$cont = trim($cont);
$cont = str_replace("\r", '', $cont);
$ary = explode("\n", $cont);
$cont = '';
foreach ($ary as $a) {
$a = trim($a);
if ($a == '') continue;
$cont .= "$a\n";
}
$cont = preg_replace('@^(Domain|Registrar|Date Created|Date Modified|Expiry Date)\n@ismU', '$1: ', $cont);
$cont = str_replace('DNS Server',
"\nDNS Server\n", $cont);
$cont = str_replace('Registrant',
"\nRegistrant\n", $cont);
$cont = str_replace('Other results you may like',
"\nOther results you may like\n\n", $cont);
$cont = preg_replace("@ {0,1}:\n@ismU", ": ", $cont);
$cont = str_replace(' : ', ': ', $cont);
# ---
$puburl = 'http://www.vunic.vu/whoiss/whois.php';
echo "Information about $domain extracted from $puburl:\n\n";
echo $cont."\n";