Rev 5 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/php
<?php
#
# VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
# Subprogram: ac TLD whois
#
# (c) 2011-2014 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
#
# License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
#
require_once __DIR__ . '/../../../shared/php_includes/common_functions.inc.php';
$domain = isset($argv[1]) ? $argv[1] : '';
$url = "http://www.nic.ac/cgi-bin/whois?query=$domain";
$res = "% Parsing via regex from '$url'\n\n";
$x = file_get_contents2($url);
preg_match_all('|<div class="mainboxBody">(.*)<div class="mainboxFoot">|ismU', $x, $m);
if (!isset($m[1][0])) {
fwrite(STDERR, "Cannot parse page (mainboxBody missing). Please report this bug.\n");
exit(1);
}
$x = $m[1][0];
$x = strip_tags($x);
$x = preg_replace('|:\s*([^\s])|ismU', ': $1', $x);
$x = preg_replace('|^\s*([^\s])|ismU', '$1', $x);
$x = html_entity_decode($x);
$special_words = array(
'Domain Information',
'Admin Contact',
'Technical Contact',
'Billing Contact',
'Primary Nameserver',
'Secondary Nameserver'
);
foreach ($special_words as $s) {
$x = str_replace($s, "\n".strtoupper($s)."\n", $x);
}
$x = make_tabs($x);
$x = trim($x);
$x = str_replace(' - CLICK TO BUY', '', $x);
echo $res.trim_each_line($x)."\n";