Login | ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/vgwhois/trunk/main/subprograms/pa
Revision: 45
Committed: Sat Mar 28 23:50:01 2020 UTC (3 months, 1 week ago) by daniel-marschall
File size: 1897 byte(s)
Log Message:
TLD ".ve" update

File Contents

# Content
1 #!/usr/bin/php
2 <?php
3
4 #
5 # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
6 # Subprogram: pa TLD whois
7 #
8 # (c) 2011-2019 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
9 #
10 # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
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://nic.pa/es/whois/dominio/$domain";
18 $res = "% Parsing via regex from '$url'\n\n";
19 $cont = file_get_contents($url);
20
21 if (preg_match('@<h2>Nombre del Dominio:\s*(.+)\s*</h2>(.+)</div>@ismU', $cont, $m)) {
22 $cont = "Domain ".$m[1].":\n".$m[2];
23 }
24
25 $x = strip_tags($cont);
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 = str_replace('&nbsp;', ' ', $x);
39
40 $x = html_entity_decode($x);
41
42 $x = str_replace("\t", ' ', $x);
43
44 $x = preg_replace("| +|", ' ', $x);
45 $x = preg_replace("|\n *|", "\n", $x);
46 $x = preg_replace("| *\n|", "\n", $x);
47 $x = preg_replace("|\n+|", "\n", $x);
48
49 $x = str_replace(":\n", ": ", $x);
50
51 $x = str_replace("Nombre\n", 'Nombre ', $x);
52 $x = str_replace("Contacto\n", 'Contacto ', $x);
53 $x = str_replace("Fecha\n", 'Fecha ', $x);
54
55 if (strpos($x, 'Fecha de Creación: 0000-00-00') !== false) {
56 echo "Domain '$domain' does not exist!";
57 exit(2);
58 }
59
60 $special_words = array(
61 "Información del Dominio $domain",
62 );
63
64 foreach ($special_words as $s) {
65 $x = str_replace($s, "\n".uc_latin1($s)."\n", $x);
66 }
67
68 $x = str_replace("Datos Obtenidos de nuestra base de datos ...\n$domain\n", "\n>>>>", $x);
69
70 # Emulate tabulators.
71 $cry = explode(">>>>", $x, 2);
72 $x = make_tabs($cry[0]);
73
74 if (isset($cry[1])) $x .= '>>>> '.$cry[1];
75
76 $x = trim($x);
77
78 echo $res.trim_each_line($x)."\n";

Properties

Name Value
svn:executable *