Rev 11 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11 | Rev 149 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | 3 | ||
4 | # |
4 | # |
5 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
5 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
6 | # Subprogram: cu TLD whois |
6 | # Subprogram: cu TLD whois |
7 | # |
7 | # |
8 | # (c) 2011-2012 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
8 | # (c) 2011-2024 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
9 | # |
9 | # |
10 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
10 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
11 | # |
11 | # |
12 | 12 | ||
13 | require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php'; |
13 | require_once __DIR__ . '/../../shared/php_includes/common_functions.inc.php'; |
14 | 14 | ||
- | 15 | ini_set('default_charset', 'UTF-8'); |
|
- | 16 | ||
15 | $domain = isset($argv[1]) ? $argv[1] : ''; |
17 | $domain = isset($argv[1]) ? $argv[1] : ''; |
16 | 18 | ||
17 | define('BEGIN', '<!-- InstanceBeginEditable name="MainRgn" -->'); |
19 | define('BEGIN', '<!-- InstanceBeginEditable name="MainRgn" -->'); |
18 | define('END', '<!-- InstanceEndEditable -->'); |
20 | define('END', '<!-- InstanceEndEditable -->'); |
19 | 21 | ||
20 | $url = "http://www.nic.cu/dom_det.php?domsrch=$domain"; |
22 | $url = "https://www.nic.cu/dom_det.php?domsrch=$domain"; |
21 | 23 | ||
22 | $res = "% Parsing via regex from '$url'\n\n"; |
24 | $res = "% Parsing via regex from '$url'\n\n"; |
23 | 25 | ||
24 | $x = file_get_contents2($url); |
26 | $x = file_get_contents2($url); |
25 | 27 | ||
26 | preg_match_all('@'.preg_quote(BEGIN, '@').'(.*)'.preg_quote(END, '@').'@ismU', $x, $m); |
28 | preg_match_all('@'.preg_quote(BEGIN, '@').'(.*)'.preg_quote(END, '@').'@ismU', $x, $m); |
27 | 29 | ||
28 | if (!isset($m[1][0])) { |
30 | if (!isset($m[1][0])) { |
29 | echo "Error while parsing the web content. Could not find limitations.\n"; |
31 | echo "Error while parsing the web content (RegEx failed).\n"; |
30 | exit(1); |
32 | exit(1); |
31 | } |
33 | } |
32 | 34 | ||
33 | $x = $m[1][0]; |
35 | $x = $m[1][0]; |
34 | 36 | ||
35 | $x = strip_tags($x); |
37 | $x = strip_tags($x); |
36 | 38 | ||
37 | // é -> É @ strtoupper() |
- | |
38 | /* |
- | |
39 | $locals = array('es_ES@euro', 'es_ES', 'es'); |
- | |
40 | reset($locals); |
- | |
41 | while (list(, $locale) = each ($locals)) { |
- | |
42 | if ( setlocale(LC_CTYPE, $locale) == $locale ) { |
- | |
43 | break; // Exit when we were successfull |
- | |
44 | } |
- | |
45 | } |
- | |
46 | */ |
- | |
47 | - | ||
48 | $x = str_replace(' ', ' ', $x); |
39 | $x = str_replace(' ', ' ', $x); |
49 | 40 | ||
50 | $x = html_entity_decode($x); |
41 | $x = html_entity_decode($x); |
51 | 42 | ||
52 | $x = preg_replace("| +|", ' ', $x); |
43 | $x = preg_replace("| +|", ' ', $x); |
Line 56... | Line 47... | ||
56 | 47 | ||
57 | $x = str_replace(":\n", ": ", $x); |
48 | $x = str_replace(":\n", ": ", $x); |
58 | 49 | ||
59 | $special_words = array( |
50 | $special_words = array( |
60 | 'Detalles del dominio', |
51 | 'Detalles del dominio', |
61 | 'Información general del dominio', |
52 | 'Información general del dominio', |
62 | 'DNS Primario', |
53 | 'DNS Primario', |
63 | 'Contacto Técnico', |
54 | 'Contacto Técnico', |
64 | 'Contacto Administrativo', |
55 | 'Contacto Administrativo', |
65 | 'Contacto Financiero' |
56 | 'Contacto Financiero' |
66 | ); |
57 | ); |
67 | 58 | ||
68 | foreach ($special_words as $s) { |
59 | foreach ($special_words as $s) { |
69 | $x = str_replace($s, "\n".uc_latin1($s)."\n", $x); |
60 | $x = str_replace($s, "\n".mb_strtoupper($s)."\n", $x); |
70 | } |
61 | } |
71 | 62 | ||
72 | $x = str_replace('< Regresar a la página anterior', '', $x); |
63 | $x = str_replace('< Regresar a la página anterior', '', $x); |
73 | 64 | ||
74 | $x = make_tabs($x); |
65 | $x = make_tabs($x); |
75 | 66 | ||
76 | $x = trim($x); |
67 | $x = trim($x); |
77 | 68 | ||
78 | if (strpos($x, 'Dominio: Organización: Dirección:') !== false) { |
69 | if (preg_match('@Dominio: *Organización: *Dirección:@', $x)) { |
79 | $x = 'Domain does not exist.'; |
70 | $x = 'Domain does not exist.'; |
80 | } |
71 | } |
81 | 72 | ||
82 | #does not work... |
- | |
83 | #if ($x == 'DETALLES DEL DOMINIO\n\nINFORMACIÓN GENERAL DEL DOMINIO\n\nDominio: Organización: Dirección:\n\nDNS\nNombre: Dirección IP:\nContacto\nNombre: Organización: Dirección: Teléfono: Fax:') { |
- | |
84 | if (md5($x) == '82f755ffa4a436159afec22d69be304c') { |
- | |
85 | $x = 'Domain not available.'; |
- | |
86 | } |
- | |
87 | - | ||
88 | echo $res.trim_each_line($x)."\n"; |
73 | echo $res.trim_each_line($x)."\n"; |