Rev 45 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#!/usr/bin/php
<?php
#
# VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
# Subprogram: pa TLD whois
#
# (c) 2011-2019 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';
ini_set('default_charset', 'UTF-8');
$domain = isset($argv[1]) ? $argv[1] : '';
$url = "http://nic.pa/es/whois/dominio/$domain";
$res = "% Parsing via regex from '$url'\n\n";
$cont = file_get_contents2($url);
if (preg_match('@<h2>Nombre del Dominio:\s*(.+)\s*</h2>(.+)</div>@ismU', $cont, $m)) {
$cont = "Domain ".$m[1].":\n".$m[2];
}
$x = strip_tags($cont);
$x = str_replace(' ', ' ', $x);
$x = html_entity_decode($x);
$x = str_replace("\t", ' ', $x);
$x = preg_replace("| +|", ' ', $x);
$x = preg_replace("|\n *|", "\n", $x);
$x = preg_replace("| *\n|", "\n", $x);
$x = preg_replace("|\n+|", "\n", $x);
$x = str_replace(":\n", ": ", $x);
$x = str_replace("Nombre\n", 'Nombre ', $x);
$x = str_replace("Contacto\n", 'Contacto ', $x);
$x = str_replace("Fecha\n", 'Fecha ', $x);
if (strpos($x, 'Fecha de Creación: 0000-00-00') !== false) {
echo "Domain '$domain' does not exist!";
exit(2);
}
$special_words = array(
"Información del Dominio $domain",
);
foreach ($special_words as $s) {
$x = str_replace($s, "\n".mb_strtoupper($s)."\n", $x);
}
$x = str_replace("Datos Obtenidos de nuestra base de datos ...\n$domain\n", "\n>>>>", $x);
// Emulate tabulators.
$cry = explode(">>>>", $x, 2);
$x = make_tabs($cry[0]);
if (isset($cry[1])) $x .= '>>>> '.$cry[1];
$x = trim($x);
echo $res.trim_each_line($x)."\n";