Subversion Repositories vgwhois

Rev

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: vi TLD whois
#
#  (c) 2013 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 = 'https://secure.nic.vi/whois-lookup/';

$post = 'submitted=true&domainName='.rawurlencode($domain);

$cont = file_get_contents2($url, $post);

if (preg_match('@<div class="results">(.+)</div>@ismU', $cont, $m)) {
        $cont = $m[1];
}

// There is a "secret" field named "Name". Why hide it?
$cont = str_replace('<!--', '', $cont);
$cont = str_replace('-->', '', $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);

echo "Information about $domain extracted from $url:\n\n";
echo $cont."\n";