Subversion Repositories vgwhois

Rev

Rev 5 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
#!/usr/bin/php
2
<?php
3
 
4
#
11 daniel-mar 5
#  VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
5 daniel-mar 6
#  Subprogram: sh TLD whois
2 daniel-mar 7
#
5 daniel-mar 8
#  (c) 2013 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
2 daniel-mar 9
#
5 daniel-mar 10
#  License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
2 daniel-mar 11
#
12
 
13
require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php';
14
 
15
$domain = isset($argv[1]) ? $argv[1] : '';
16
 
17
$url = "http://www.nic.sh/cgi-bin/whois?query=$domain";
18
 
19
$cont = file_get_contents2($url);
20
 
21
if (preg_match('@<!--- ### --->(.+)<!--- ### --->@ismU', $cont, $m)) {
22
        $cont = $m[1];
23
} else {
24
        // Error or domain is available
25
        if (preg_match('@<!--- ERROR: .+ --->\n\n<h2>Domain Information</h2>\n<hr>\n<h3>.+</h3>(.+)<br /><br />@ismU', $cont, $m)) {
26
                $cont = $m[1];
27
        }
28
}
29
 
30
$cont = html_entity_decode(strip_tags($cont));
31
 
32
// Remove whitespaces at the beginning of each line
33
$cont = preg_replace('@([\r\n])[ \t]+(\S)@isU', '\\1\\2', $cont);
34
$cont = trim($cont);
35
 
36
echo "Information about $domain extracted from $url:\n\n";
37
echo $cont."\n";