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: gt TLD whois |
2 | daniel-mar | 7 | # |
5 | daniel-mar | 8 | # (c) 2011-2012 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.gt/cgi-bin/whois.cgi?domain=$domain"; |
||
18 | |||
19 | $res = "% Parsing via regex from '$url'\n\n"; |
||
20 | |||
21 | $x = file_get_contents2($url); |
||
22 | $x = strip_tags($x); |
||
23 | |||
24 | # $x = preg_replace('|:\s*([^\s])|ismU', ': $1', $x); |
||
25 | $x = preg_replace('|^\s*([^\s])|ismU', '$1', $x); |
||
26 | |||
27 | // é -> É @ strtoupper() |
||
28 | /* |
||
29 | $locals = array('es_ES@euro', 'es_ES', 'es'); |
||
30 | reset($locals); |
||
31 | while (list(, $locale) = each ($locals)) { |
||
32 | if ( setlocale(LC_CTYPE, $locale) == $locale ) { |
||
33 | break; // Exit when we were successfull |
||
34 | } |
||
35 | } |
||
36 | */ |
||
37 | |||
38 | $x = html_entity_decode($x); |
||
39 | |||
40 | $special_words = array( |
||
41 | 'Información del Dominio'."\n".$domain, |
||
42 | 'Contactos Administrativos', |
||
43 | 'Contactos Técnicos', |
||
44 | 'Servidores', |
||
45 | 'Fecha de Expiración (dd/mm/aaaa)' |
||
46 | ); |
||
47 | |||
48 | foreach ($special_words as $s) { |
||
49 | $x = str_replace($s, "\n".uc_latin1($s)."\n", $x); |
||
50 | } |
||
51 | |||
52 | $x = str_replace('Inicio', '', $x); // Back to mainpage |
||
53 | |||
54 | $x = str_replace('Primario', "Primario\n\n", $x); |
||
55 | $x = str_replace('Secundario', "Secundario\n\n", $x); |
||
56 | |||
57 | $x = trim($x); |
||
58 | |||
59 | echo $res.trim_each_line($x)."\n"; |