Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Para usar:
<?php
/**
* Coloque todos os domínios que você quer ter um checkbox
* @var array
*/
$sufixos = array(
'com.br',
'com',
'net',
'org'
);
/**
* Recebendo a variável $_POST[ 'dominio' ] do formulário se tiver sido enviada
* @var string
*/
$dominio =& $_POST[ 'dominio' ];
/**
* Recebendo a variável $_POST[ 'extencao' ] do formulário se tiver sido enviada
* @var string
*/
$extencao =& $_POST[ 'extencao' ];
/**
* Como precisamos que $extencao seja uma matriz, criamos uma vazia caso não seja.
*/
if ( !is_array( $extencao ) ) $extencao = array();
echo '<?xml version="1.0" encoding="UTF-8"?>';
?><html xml:lang="pt_br" lang="pt_br" xmlns="http-~~-//www.w3.org/1999/xhtml">
<head>
<title>Domínios</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head>
<body>
<form action="<?php echo $_SERVER[ 'PHP_SELF' ]; ?>" method="post">
<fieldset>
<legend>Domínio</legend>
<label for="d1">
<span>www.</span><input id="d1" type="text" name="dominio" value="<?php echo $dominio; ?>" />
</label>
</fieldset>
<fieldset>
<legend>Sufixos</legend>
<?php
/**
* Aqui montamos os checkbox para cada um dos sufixos definidos na matriz $sufixos
*/
for ( $i = 0 , $t = count( $sufixos ) ; $i < $t ; ++$i ){
printf( '<label for="c%d">' , $i );
printf( '<input id="c%d" type="checkbox" name="extencao[]" value="%s" %s/>' , $i , $sufixos[ $i ] , in_array( $sufixos[ $i ] , $extencao ) ? 'checked="checked"' : null );
printf( '<span>.%s</span>' , $sufixos[ $i ] );
print( '</label>' );
}
?>
<input id="Enviar" type="submit" value="Enviar" />
</fieldset>
</form>
<?php
if ( $_SERVER[ 'REQUEST_METHOD' ] == 'POST' ){
if ( !empty( $dominio ) ){
if ( count( $extencao ) ){
require 'lib/remote/Whois/Whois.php';
$socket = new Socket();
print( '<table>' );
print( '<thead><tr><th>Domínio</th><th>Informação</th><th>Criação</th><th>Expira</th></tr></thead>' );
print( '<tbody>' );
/**
* Aqui montamos a tabela com os dados do domínio
*/
foreach ( $extencao as $item ){
print( '<tr>' );
printf( '<td>www.%s.%s</td>' , $dominio , $item );
$whois = new Whois( $dominio , $item );
try {
if ( $whois->check( $socket , $response = new WhoisResponse() ) ){
if ( $response->valid() ){
printf( '<td>%s<br />%s</td>' , $response->get( 'owner' ) , $response->get( 'person' ) );
printf( '<td>%s</td>' , $response->get( 'created' ) );
printf( '<td>%s</td>' , $response->get( 'expires' ) );
}
} else {
printf( '<td colspan="3">O domínio %s.%s está disponível para registro.</td>' , $whois->getDomain() , $whois->getSufix() );
}
} catch ( Exception $e ){
print( '<td colspan="3">Não foi possível fazer a consulta</td>' );
}
print( '</tr>' );
}
print( '</tbody>' );
print( '</table>' );
} else {
echo '<p><strong>Nenhuma extenção especificada.</strong></p>';
}
} else {
echo '<p><strong>Domínio não especificado.</strong></p>';
}
}
?>
</body>
</html>
Hierarquia de diretórios:
lib
lib/remote
lib/remote/connector
lib/remote/connector/interface
lib/remote/Whois
Os arquivos:
lib/remote/connector/interface/AbstractResponse.php
<?php
/**
* Base para implementação de uma resposta à uma requisição remota
* @abstract
* @author João Neto
* @package remote
*/
abstract class AbstractResponse implements IRemoteResponse , IteratorAggregate {
/**
* @var string
*/
protected $raw;
/**
* @var ArrayObject
*/
protected $storage;
/**
* Cria o objeto de resposta e instancia as propriedades
*/
public function __construct(){
$this->storage = new ArrayObject();
}
/**
* Interpreta a resposta
* @abstract
*/
abstract protected function parse();
/**
* Recupera uma determinada informação da resposta
* @param string $key
*/
public function get( $key ){
$ret = null;
if ( $this->storage->offsetExists( $key ) ){
$ret = $this->storage[ $key ];
}
return $ret;
}
/**
* Recupera a lista de cabeçalhos de resposta
* @return ArrayObject
*/
public function getHeaders(){
return new ArrayObject();
}
/**
* Implementa o método getIterator
* @return ArrayIterator
* @see IteratorAggregate::getIterator()
*/
public function getIterator(){
return new ArrayIterator( $this->storage );
}
/**
* Recupera a resposta sem tratamento
* @return string
*/
public function getRaw(){
return $this->raw;
}
/**
* Define a resposta da requisição
* @param string $raw
*/
public function setRaw( $raw ){
if ( is_string( $raw ) ){
$this->raw =& $raw;
$this->storage = new ArrayObject();
$this->parse();
} else throw new InvalidArgumentException( '%s expects a string.' , __METHOD__ );
}
/**
* Verifica se o retorno é válido
* @return boolean
*/
public function valid(){
return !empty( $this->raw );
}
}
lib/remote/connector/interface/IRemoteConnection.php
<?php
/**
* Interface para uma conexão remota
* @author João Neto
* @package remote
*/
interface IRemoteConnection {
/**
* Timeout padrão
*/
const DEFAULT_TIMEOUT = 30;
/**
* Fecha a conexão
*/
public function close();
/**
* Verifica se o ponteiro chegou ao fim
* @return boolean
*/
public function eof();
/**
* Abre uma conexão socket
* @param string $uri O servidor que será conectado
* @param string $port A porta que será utilizada na conexão
* @param integer $timeout Tempo em segundos que será aguardado por uma resposta
* @return boolean
*/
public function open( $uri , $port = 43 , $timeout = self::DEFAULT_TIMEOUT );
/**
* Lê uma informação do servidor
* @param integer $length Número de bytes que serão lidos
* @return string|boolean A string lida ou FALSE se não tive sido possível ler
*/
public function read( $length );
/**
* Escreve uma informação no servidor
* @param string $data A informação que será escrita
* @param integer $length Tamanho da string que será escrita
* @return integer Número de bytes escrito
*/
public function write( $data , $length = null );
}
lib/remote/connector/interface/IRemoteResponse.php
<?php
/**
* Resposta de uma requisição
* @author João Neto
* @package remote
*/
interface IRemoteResponse {
/**
* Recupera a resposta sem tratamento
* @return string
*/
public function getRaw();
/**
* Recupera uma determinada informação da resposta
* @param string $key
*/
public function get( $key );
/**
* Recupera a lista de cabeçalhos de resposta
* @return ArrayObject
*/
public function getHeaders();
/**
* Define a resposta da requisição
* @param string $raw
*/
public function setRaw( $raw );
/**
* Verifica se o retorno é válido
* @return boolean
*/
public function valid();
}
lib/remote/connector/Socket.php
<?php
/**
* Efetua uma conexão via socket
* @author João Neto
* @package remote
*/
class Socket implements IRemoteConnection {
/**
* @var resource
*/
private $fh;
/**
* Destroi o objeto e fecha a conexão se ainda estiver aberta
*/
public function __destruct(){
if ( is_resource( $this->fh ) ){
fclose( $this->fh );
}
}
/**
* Fecha a conexão
*/
public function close(){
$this->testResource();
fclose( $this->fh );
$this->fh = null;
}
/**
* Verifica se o ponteiro chegou ao fim
* @return boolean
*/
public function eof(){
$this->testResource();
return feof( $this->fh );
}
/**
* Abre uma conexão socket
* @param string $uri O servidor que será conectado
* @param string $port A porta que será utilizada na conexão
* @param integer $timeout Tempo em segundos que será aguardado por uma resposta
* @return boolean
* @throws RuntimeException Se não for possível conectar
*/
public function open( $uri , $port = 43 , $timeout = self::DEFAULT_TIMEOUT ){
$error = null;
$errno = 0;
if ( is_resource( $this->fh ) ) $this->close();
if ( !is_resource( $this->fh = @fsockopen( $uri , $port , $errno , $error , $timeout ) ) ){
throw new RuntimeException( $error , $errno );
}
return $errno == 0;
}
/**
* Lê uma informação do servidor
* @param integer $length Número de bytes que serão lidos
* @return string|boolean A string lida ou FALSE se não tive sido possível ler
* @throws InvalidArgumentException Se o parâmetro $length não for um inteiro
*/
public function read( $length ){
if ( is_int( $length ) ){
$this->testResource();
return fread( $this->fh , $length );
} else throw new InvalidArgumentException( sprintf( '%s expects an integer.' , __METHOD__ ) );
}
/**
* Verifica se existe um recurso de conexão
*/
private function testResource(){
if ( !is_resource( $this->fh ) ){
throw new BadMethodCallException( 'Not connected.' );
}
}
/**
* Escreve uma informação no servidor
* @param string $data A informação que será escrita
* @param integer $length Tamanho da string que será escrita
* @return integer Número de bytes escrito
* @throws InvalidArgumentException Se o parâmetro $data não for uma string
*/
public function write( $data , $length = null ){
$ret = 0;
if ( is_string( $data ) || ( is_object( $data ) && is_callable( array( $data , '__toString' ) ) ) ){
$this->testResource();
$ret = fwrite( $this->fh , $data , is_int( $length ) ? $length : strlen( $data ) );
} else throw new InvalidArgumentException( sprintf( '%s expects a string.' , __METHOD__ ) );
return $ret;
}
}
lib/remote/Whois/Whois.php
<?php
require 'lib/remote/connector/interface/IRemoteResponse.php';
require 'lib/remote/connector/interface/AbstractResponse.php';
require 'lib/remote/connector/interface/IRemoteConnection.php';
require 'lib/remote/connector/Socket.php';
require 'WhoisResponse.php';
/**
* Faz uma consulta Whois para um domínio
* @author João Neto
* @package Whois
*/
class Whois {
/**
* XML namespace
*/
const XML_NAMESPACE = 'urn:neto/whois';
/**
* XML file name
*/
const XML_FILE = 'whois.xml';
/**
* XML Schema file name
*/
const XML_SCHEMA = 'whois.xsd';
/**
* Prefixo do XML
*/
const XML_PREFIX = 'tns';
/**
* Regular expression for URI validation
*/
const URI_REGEXP = '/^(?:a-zA-Z0-9){0,61}[a-zA-Z0-9]?\.)*a-zA-Z0-9){0,61}[a-zA-Z0-9]?$/';
/**
* @var DOMDocument
*/
private static $dom;
/**
* @var DOMXPath
*/
private static $xpath;
/**
* @var string
*/
private $domain;
/**
* @var string
*/
private $suffix;
/**
* @var string
*/
private $whois;
/**
* @var string
*/
private $noMatch;
/**
* @param string $domain O domínio que será consultado
* @param string $suffix O sufixo do domínio (com.br, com, net, org, etc)
*/
public function __construct( $domain , $suffix ){
$this->setDomain( $domain );
$this->setSuffix( $suffix );
}
/**
* Efetua a consulta Whois
* @param IRemoteConnection $connector Instância de IRemoteConnection que será utilizada para a conexão
* @param string $responseClass Classe que será utilizada para o retorno
* @return boolean FALSE se não for possível recuperar a resposta
*/
public function check( IRemoteConnection $connector , IRemoteResponse $response ){
$ret = false;
$raw = null;
$connector->open( $this->whois );
$connector->write( sprintf( "%s.%s\n" , $this->domain , $this->suffix ) );
while ( !$connector->eof() ){
$raw .= $connector->read( 2048 );
}
$connector->close();
if ( !preg_match( sprintf( '`%s`' , preg_quote( $this->noMatch ) ) , $raw ) ){
$ret = true;
$response->setRaw( $raw );
}
return $ret;
}
/**
* Carrega e verifica o XML que contém as informações dos servidores Whois
* @throws RuntimeException Se o XML for inválido
*/
private function checkXML(){
if ( !( self::$dom instanceOf DOMDocument ) ){
$dir = dirname( __FILE__ );
self::$dom = new DOMDocument( '1.0' , 'utf-8' );
self::$dom->load( sprintf( '%s/%s' , $dir , self::XML_FILE ) );
if ( !@self::$dom->schemaValidate( sprintf( '%s/%s' , $dir , self::XML_SCHEMA ) ) ){
throw new RuntimeException( 'Invalid XML' );
}
self::$xpath = new DOMXPath( self::$dom );
self::$xpath->registerNamespace( self::XML_PREFIX , self::XML_NAMESPACE );
}
}
/**
* Recupera o domínio
* @return string
*/
public function getDomain(){
return $this->domain;
}
/**
* Recupera o sufixo
* @return string
*/
public function getSufix(){
return $this->suffix;
}
/**
* Define o domínio que será consultado
* @param string $domain
*/
public function setDomain( $domain ){
$this->domain =& $domain;
}
/**
* Define o sufixo do domínio que será consultado
* @param string $suffix
* @throws InvalidArgumentException Se não existir um servidor whois para o sufixo especificado
*/
public function setSuffix( $suffix ){
$found = false;
$this->checkXML();
foreach ( self::$xpath->query( sprintf( './/%s:server[@suffix="%s"]' , self::XML_PREFIX , $suffix ) ) as $server ){
$this->suffix =& $suffix;
$this->noMatch =& $server->nodeValue;
$this->whois = $server->getAttribute( 'uri' );
$found = true;
break;
}
if ( !$found ) throw new InvalidArgumentException( sprintf( 'Unknown suffix %s.' , $suffix ) );
}
}
lib/remote/Whois/whois.xml
<?xml version="1.0" encoding="utf-8"?>
<whois
xmlns="urn:neto/whois"
xmlns:xsi="http-~~-//www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:neto/whois whois.xsd ">
<server uri="whois.nic.ac" suffix="ac">No match</server>
<server uri="whois.cnnic.net.cn" suffix="ac.cn">no matching record</server>
<server uri="whois.nic.ad.jp" suffix="ac.jp">No match</server>
<server uri="whois.ja.net" suffix="ac.uk">No such domain</server>
<server uri="whois.nic.ad.jp" suffix="ad.jp">No match</server>
<server uri="whois.nic.br" suffix="adm.br">No match</server>
<server uri="whois.nic.br" suffix="adv.br">No match</server>
<server uri="whois.nic.ag" suffix="ag">Not found</server>
<server uri="whois.nic.br" suffix="agr.br">No match</server>
<server uri="whois.cnnic.net.cn" suffix="ah.cn">No entries found</server>
<server uri="whois.ripe.net" suffix="al">No entries found</server>
<server uri="whois.amnic.net" suffix="am">No match</server>
<server uri="whois.nic.br" suffix="am.br">No match</server>
<server uri="whois.nic.br" suffix="arq.br">No match</server>
<server uri="whois.nic.at" suffix="at">nothing found</server>
<server uri="whois.aunic.net" suffix="au">No Data Found</server>
<server uri="whois.nic.br" suffix="art.br">No match</server>
<server uri="whois.nic.as" suffix="as">Domain Not Found</server>
<server uri="whois.aunic.net" suffix="asn.au">No Data Found</server>
<server uri="whois.nic.br" suffix="ato.br">No match</server>
<server uri="whois.nic.tr" suffix="av.tr">Not found in database</server>
<server uri="whois.ripe.net" suffix="az">no entries found</server>
<server uri="whois.ripe.net" suffix="ba">No match for</server>
<server uri="whois.geektools.com" suffix="be">No such domain</server>
<server uri="whois.digsys.bg" suffix="bg">does not exist</server>
<server uri="whois.nic.br" suffix="bio.br">No match</server>
<server uri="whois.biz" suffix="biz">Not found</server>
<server uri="whois.nic.tr" suffix="biz.tr">Not found in database</server>
<server uri="whois.cnnic.net.cn" suffix="bj.cn">No entries found</server>
<server uri="whois.nic.tr" suffix="bel.tr">Not found in database</server>
<server uri="whois.nic.br" suffix="bmd.br">No match</server>
<server uri="whois.registro.br" suffix="br">No match</server>
<server uri="whois.ripe.net" suffix="by">no entries found</server>
<server uri="whois.cira.ca" suffix="ca">Status: AVAIL</server>
<server uri="whois.nic.cc" suffix="cc">No match</server>
<server uri="whois.cd" suffix="cd">No match</server>
<server uri="whois.nic.ch" suffix="ch">We do not have an entry</server>
<server uri="whois.nic.br" suffix="cim.br">No match</server>
<server uri="whois.ck-nic.org.ck" suffix="ck">No entries found</server>
<server uri="whois.nic.cl" suffix="cl">no existe</server>
<server uri="whois.cnnic.net.cn" suffix="cn">No entries found</server>
<server uri="whois.nic.br" suffix="cng.br">No match</server>
<server uri="whois.nic.br" suffix="cnt.br">No match</server>
<server uri="whois.crsnic.net" suffix="com">No match</server>
<server uri="whois.aunic.net" suffix="com.au">No Data Found</server>
<server uri="whois.nic.br" suffix="com.br">No match</server>
<server uri="whois.cnnic.net.cn" suffix="com.cn">No entries found</server>
<server uri="whois.ripe.net" suffix="com.eg">No entries found</server>
<server uri="whois.hknic.net.hk" suffix="com.hk">No Match for</server>
<server uri="whois.nic.mx" suffix="com.mx">Nombre del Dominio</server>
<server uri="whois.nic.tr" suffix="com.tr">Not found in database</server>
<server uri="whois.ripn.ru" suffix="com.ru">No entries found</server>
<server uri="whois.twnic.net" suffix="com.tw">NO MATCH TIP</server>
<server uri="whois.aunic.net" suffix="conf.au">No entries found</server>
<server uri="whois.nic.at" suffix="co.at">nothing found</server>
<server uri="whois.nic.ad.jp" suffix="co.jp">No match</server>
<server uri="whois.nic.uk" suffix="co.uk">No match for</server>
<server uri="whois.cnnic.net.cn" suffix="cq.cn">No entries found</server>
<server uri="whois.aunic.net" suffix="csiro.au">No Data Found</server>
<server uri="whois.nic.cx" suffix="cx">No match</server>
<server uri="whois.ripe.net" suffix="cy">no entries found</server>
<server uri="whois.nic.cz" suffix="cz">No data found</server>
<server uri="whois.denic.de" suffix="de">not found</server>
<server uri="whois.nic.tr" suffix="dr.tr">Not found in database</server>
<server uri="whois.dk-hostmaster.dk" suffix="dk">No entries found</server>
<server uri="whois.ripe.net" suffix="dz">no entries found</server>
<server uri="whois.nic.br" suffix="ecn.br">No match</server>
<server uri="whois.eenet.ee" suffix="ee">NOT FOUND</server>
<server uri="whois.crsnic.net" suffix="edu">No match</server>
<server uri="whois.aunic.net" suffix="edu.au">No Data Found</server>
<server uri="whois.nic.br" suffix="edu.br">No match</server>
<server uri="whois.nic.tr" suffix="edu.tr">Not found in database</server>
<server uri="whois.ripe.net" suffix="eg">No entries found</server>
<server uri="whois.ripe.net" suffix="es">No entries found</server>
<server uri="whois.nic.br" suffix="esp.br">No match</server>
<server uri="whois.nic.br" suffix="etc.br">No match</server>
<server uri="whois.nic.br" suffix="eti.br">No match</server>
<server uri="whois.ripe.net" suffix="eun.eg">No entries found</server>
<server uri="whois.aunic.net" suffix="emu.id.au">No Data Found</server>
<server uri="whois.nic.br" suffix="eng.br">No match</server>
<server uri="whois.eu" suffix="eu">Status: FREE</server>
<server uri="whois.nic.br" suffix="far.br">No match</server>
<server uri="whois.ripe.net" suffix="fi">No entries found</server>
<server uri="whois.usp.ac.fj" suffix="fj"></server>
<server uri="whois.cnnic.net.cn" suffix="fj.cn">No entries found</server>
<server uri="whois.nic.br" suffix="fm.br">No match</server>
<server uri="whois.nic.br" suffix="fnd.br">No match</server>
<server uri="whois.ripe.net" suffix="fo">no entries found</server>
<server uri="whois.nic.br" suffix="fot.br">No match</server>
<server uri="whois.nic.br" suffix="fst.br">No match</server>
<server uri="whois.nic.fr" suffix="fr">No entries found</server>
<server uri="whois.ripe.net" suffix="gb">No match for</server>
<server uri="whois.nomination.net" suffix="gb.com">No match for</server>
<server uri="whois.nomination.net" suffix="gb.net">No match for</server>
<server uri="whois.nic.br" suffix="g12.br">No match</server>
<server uri="whois.cnnic.net.cn" suffix="gd.cn">No entries found</server>
<server uri="whois.ripe.net" suffix="ge">no entries found</server>
<server uri="whois.nic.tr" suffix="gen.tr">Not found in database</server>
<server uri="whois.nic.br" suffix="ggf.br">No match</server>
<server uri="whois.ripe.net" suffix="gl">no entries found</server>
<server uri="whois.ripe.net" suffix="gr">no entries found</server>
<server uri="whois.nic.ad.jp" suffix="gr.jp">No match</server>
<server uri="whois.adamsnames.tc" suffix="gs">is not registered</server>
<server uri="whois.cnnic.net.cn" suffix="gs.cn">No entries found</server>
<server uri="whois.aunic.net" suffix="gov.au">No Data Found</server>
<server uri="whois.nic.br" suffix="gov.br">No match</server>
<server uri="whois.cnnic.net.cn" suffix="gov.cn">No entries found</server>
<server uri="whois.hknic.net.hk" suffix="gov.hk">No Match for</server>
<server uri="whois.nic.tr" suffix="gov.tr">Not found in database</server>
<server uri="whois.nic.mx" suffix="gob.mx">Nombre del Dominio</server>
<server uri="whois.cnnic.net.cn" suffix="gz.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="gx.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="he.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="ha.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="hb.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="hi.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="hl.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="hn.cn">No entries found</server>
<server uri="whois.registry.hm" suffix="hm">(null)</server>
<server uri="whois.hknic.net.hk" suffix="hk">No Match for</server>
<server uri="whois.cnnic.net.cn" suffix="hk.cn">No entries found</server>
<server uri="whois.ripe.net" suffix="hu">MAXCHARS:500</server>
<server uri="whois.aunic.net" suffix="id.au">No Data Found</server>
<server uri="whois.domainregistry.ie" suffix="ie">no match</server>
<server uri="whois.nic.br" suffix="ind.br">No match</server>
<server uri="whois.nic.br" suffix="imb.br">No match</server>
<server uri="whois.nic.br" suffix="inf.br">No match</server>
<server uri="whois.afilias.info" suffix="info">Not found</server>
<server uri="whois.aunic.net" suffix="info.au">No Data Found</server>
<server uri="whois.nic.tr" suffix="info.tr">Not found in database</server>
<server uri="whois.nic.it" suffix="it">No entries found</server>
<server uri="whois.twnic.net" suffix="idv.tw">NO MATCH TIP</server>
<server uri="whois.iana.org" suffix="int">not found</server>
<server uri="whois.isnic.is" suffix="is">No entries found</server>
<server uri="whois.isoc.org.il" suffix="il">No data was found</server>
<server uri="whois.cnnic.net.cn" suffix="jl.cn">No entries found</server>
<server uri="whois.nic.br" suffix="jor.br">No match</server>
<server uri="whois.nic.ad.jp" suffix="jp">No match</server>
<server uri="whois.cnnic.net.cn" suffix="js.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="jx.cn">No entries found</server>
<server uri="whois.nic.tr" suffix="k12.tr">Not found in database</server>
<server uri="whois.rg.net" suffix="ke">No match for</server>
<server uri="whois.krnic.net" suffix="kr">is not registered</server>
<server uri="whois.nic.la" suffix="la">NO MATCH</server>
<server uri="whois.nic.br" suffix="lel.br">No match</server>
<server uri="whois.nic.ch" suffix="li">We do not have an entry</server>
<server uri="whois.nic.lk" suffix="lk">No domain registered</server>
<server uri="whois.cnnic.net.cn" suffix="ln.cn">No entries found</server>
<server uri="ns.litnet.lt" suffix="lt">No matches found</server>
<server uri="whois.dns.lu" suffix="lu">No entries found</server>
<server uri="whois.ripe.net" suffix="lv">no entries found</server>
<server uri="whois.nic.uk" suffix="ltd.uk">No match for</server>
<server uri="whois.ripe.net" suffix="ma">No entries found</server>
<server uri="whois.nic.br" suffix="mat.br">No match</server>
<server uri="whois.ripe.net" suffix="mc">No entries found</server>
<server uri="whois.ripe.net" suffix="md">No match for</server>
<server uri="whois.nic.uk" suffix="me.uk">No match for</server>
<server uri="whois.nic.br" suffix="med.br">No match</server>
<server uri="whois.nic.mil" suffix="mil">No match</server>
<server uri="whois.nic.br" suffix="mil.br">No match</server>
<server uri="whois.nic.tr" suffix="mil.tr">Not found in database</server>
<server uri="whois.ripe.net" suffix="mk">No match for</server>
<server uri="whois.nic.mn" suffix="mn">Domain not found</server>
<server uri="whois.cnnic.net.cn" suffix="mo.cn">No entries found</server>
<server uri="whois.adamsnames.tc" suffix="ms">is not registered</server>
<server uri="whois.ripe.net" suffix="mt">No Entries found</server>
<server uri="whois.nic.br" suffix="mus.br">No match</server>
<server uri="whois.nic.mx" suffix="mx">Nombre del Dominio</server>
<server uri="whois.nic.name" suffix="name">No match</server>
<server uri="whois.nic.tr" suffix="name.tr">Not found in database</server>
<server uri="whois.nic.ad.jp" suffix="ne.jp">No match</server>
<server uri="whois.crsnic.net" suffix="net">No match</server>
<server uri="whois.aunic.net" suffix="net.au">No Data Found</server>
<server uri="whois.nic.br" suffix="net.br">No match</server>
<server uri="whois.cnnic.net.cn" suffix="net.cn">No entries found</server>
<server uri="whois.ripe.net" suffix="net.eg">No entries found</server>
<server uri="whois.hknic.net.hk" suffix="net.hk">No Match for</server>
<server uri="whois.dns.lu" suffix="net.lu">No entries found</server>
<server uri="whois.nic.mx" suffix="net.mx">Nombre del Dominio</server>
<server uri="whois.nic.uk" suffix="net.uk">No match for </server>
<server uri="whois.ripn.ru" suffix="net.ru">No entries found</server>
<server uri="whois.nic.tr" suffix="net.tr">Not found in database</server>
<server uri="whois.twnic.net" suffix="net.tw">NO MATCH TIP</server>
<server uri="whois.domain-registry.nl" suffix="nl">is not a registered domain</server>
<server uri="whois.cnnic.net.cn" suffix="nm.cn">No entries found</server>
<server uri="whois.norid.no" suffix="no">no matches</server>
<server uri="whois.nomination.net" suffix="no.com">No match for</server>
<server uri="whois.nic.br" suffix="nom.br">No match</server>
<server uri="whois.nic.br" suffix="not.br">No match</server>
<server uri="whois.nic.br" suffix="ntr.br">No match</server>
<server uri="whois.nic.nu" suffix="nu">NO MATCH for</server>
<server uri="whois.cnnic.net.cn" suffix="nx.cn">No entries found</server>
<server uri="whois.domainz.net.nz" suffix="nz">Not Listed</server>
<server uri="whois.nic.uk" suffix="plc.uk">No match for</server>
<server uri="whois.nic.br" suffix="odo.br">No match</server>
<server uri="whois.nic.br" suffix="oop.br">No match</server>
<server uri="whois.nic.ad.jp" suffix="or.jp">No match</server>
<server uri="whois.nic.at" suffix="or.at">nothing found</server>
<server uri="whois.pir.org" suffix="org">NOT FOUND</server>
<server uri="whois.aunic.net" suffix="org.au">No Data Found</server>
<server uri="whois.nic.br" suffix="org.br">No match</server>
<server uri="whois.cnnic.net.cn" suffix="org.cn">No entries found</server>
<server uri="whois.hknic.net.hk" suffix="org.hk">No Match for</server>
<server uri="whois.dns.lu" suffix="org.lu">No entries found</server>
<server uri="whois.ripn.ru" suffix="org.ru">No entries found</server>
<server uri="whois.nic.tr" suffix="org.tr">Not found in database</server>
<server uri="whois.twnic.net" suffix="org.tw">NO MATCH TIP</server>
<server uri="whois.nic.uk" suffix="org.uk">No match for</server>
<server uri="whois.pknic.net" suffix="pk">is not registered</server>
<server uri="whois.ripe.net" suffix="pl">No information about</server>
<server uri="whois.nic.tr" suffix="pol.tr">Not found in database</server>
<server uri="whois.ripn.ru" suffix="pp.ru">No entries found</server>
<server uri="whois.nic.br" suffix="ppg.br">No match</server>
<server uri="whois.nic.br" suffix="pro.br">No match</server>
<server uri="whois.nic.br" suffix="psi.br">No match</server>
<server uri="whois.nic.br" suffix="psc.br">No match</server>
<server uri="whois.ripe.net" suffix="pt">No match for</server>
<server uri="whois.cnnic.net.cn" suffix="qh.cn">No entries found</server>
<server uri="whois.nic.br" suffix="qsl.br">No match</server>
<server uri="whois.nic.br" suffix="rec.br">No match</server>
<server uri="whois.ripe.net" suffix="ro">No entries found</server>
<server uri="whois.ripn.ru" suffix="ru">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="sc.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="sd.cn">No entries found</server>
<server uri="whois.nic-se.se" suffix="se">No data found</server>
<server uri="whois.nomination.net" suffix="se.com">No match for</server>
<server uri="whois.nomination.net" suffix="se.net">No match for</server>
<server uri="whois.nic.net.sg" suffix="sg">NO entry found</server>
<server uri="whois.nic.sh" suffix="sh">No match for</server>
<server uri="whois.cnnic.net.cn" suffix="sh.cn">No entries found</server>
<server uri="whois.arnes.si" suffix="si">No entries found</server>
<server uri="whois.ripe.net" suffix="sk">no entries found</server>
<server uri="whois.nic.br" suffix="slg.br">No match</server>
<server uri="whois.ripe.net" suffix="sm">no entries found</server>
<server uri="whois.cnnic.net.cn" suffix="sn.cn">No entries found</server>
<server uri="whois.nic.br" suffix="srv.br">No match</server>
<server uri="whois.nic.st" suffix="st">No entries found</server>
<server uri="whois.ripe.net" suffix="su">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="sx.cn">No entries found</server>
<server uri="whois.adamsnames.tc" suffix="tc">is not registered</server>
<server uri="whois.nic.tr" suffix="tel.tr">Not found in database</server>
<server uri="whois.nic.uk" suffix="th">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="tj.cn">No entries found</server>
<server uri="whois.nic.tm" suffix="tm">No match for</server>
<server uri="whois.ripe.net" suffix="tn">No entries found</server>
<server uri="whois.nic.br" suffix="tmp.br">No match</server>
<server uri="whois.tonic.to" suffix="to">No match</server>
<server uri="whois.nic.br" suffix="trd.br">No match</server>
<server uri="whois.nic.br" suffix="tur.br">No match</server>
<server uri="whois.nic.tv" suffix="tv">MAXCHARS:75</server>
<server uri="whois.nic.br" suffix="tv.br">No match</server>
<server uri="whois.twnic.net" suffix="tw">NO MATCH TIP</server>
<server uri="whois.cnnic.net.cn" suffix="tw.cn">No entries found</server>
<server uri="whois.ripe.net" suffix="ua">No entries found</server>
<server uri="whois.thnic.net" suffix="uk">No match for</server>
<server uri="whois.nomination.net" suffix="uk.com">No match for</server>
<server uri="whois.nomination.net" suffix="uk.net">No match for</server>
<server uri="whois.nic.us" suffix="us">Not found</server>
<server uri="whois.ripe.net" suffix="va">No entries found</server>
<server uri="whois.nic.br" suffix="vet.br">No match</server>
<server uri="whois.adamsnames.tc" suffix="vg">is not registered</server>
<server uri="whois.aunic.net" suffix="wattle.id.au">No Data Found</server>
<server uri="whois.nic.tr" suffix="web.tr">Not found in database</server>
<server uri="whois.worldsite.ws" suffix="ws">No match for</server>
<server uri="whois.cnnic.net.cn" suffix="xj.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="xz.cn">No entries found</server>
<server uri="whois.cnnic.net.cn" suffix="yn.cn">No entries found</server>
<server uri="whois.ripe.net" suffix="yu">No entries found</server>
<server uri="whois.frd.ac.za" suffix="za">No match for</server>
<server uri="whois.nic.br" suffix="zlg.br">No match</server>
<server uri="whois.cnnic.net.cn" suffix="zj.cn">No entries found</server>
</whois>
lib/remote/Whois/whois.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
xmlns="urn:neto/whois"
xmlns:xsd="http-~~-//www.w3.org/2001/XMLSchema"
targetNamespace="urn:neto/whois"
elementFormDefault="qualified">
<xsd:element name="whois" type="whoisType" />
<xsd:complexType name="whoisType">
<xsd:sequence>
<xsd:element name="server" type="serverType" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="serverType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="uri" type="xsd:anyURI" use="required" />
<xsd:attribute name="suffix" type="xsd:string" use="required" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:schema>
lib/remote/Whois/WhoisResponse.php
<?php
/**
* Resposta de uma consulta Whois
* @author João Neto
* @package Whois
*/
class WhoisResponse extends AbstractResponse {
/**
* Interpreta a resposta
*/
protected function parse(){
$total = preg_match_all( '/^(\w*):\s*(.+)/mi' , $this->raw , $matches );
$count = -1;
for ( $i = 0 ; $i < $total ; ++$i ){
$prop = $matches[ 1 ][ $i ];
$value = preg_replace( "/(\r\n|\r|\n)/" , '' , $matches[ 2 ][ $i ] );
switch ( $prop ){
case "nsstat":
case "nslastaa":
break;
case "nserver":
++$count;
$this->storage[ sprintf( 'nserver %d' , ++$count ) ] = $value;
break;
case 'created':
case 'expires':
case 'changed':
$value = vsprintf( '%04d-%02d-%02d' , sscanf( $value , '%4d%2d%2d' ) );
default:
$this->storage[ $prop ] = $value;
break;
}
}
}
}Carregando comentários...