Skip to content

Instantly share code, notes, and snippets.

@dinego
Created July 16, 2014 12:18
Show Gist options
  • Save dinego/132f9b7c357c94615122 to your computer and use it in GitHub Desktop.
Save dinego/132f9b7c357c94615122 to your computer and use it in GitHub Desktop.
Função que checa domínio com php
<?php
function checkDomain($dominio){
$regexp = '/^[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/';
if (preg_match($regexp, $dominio) == 1) {
exec("host -t ns $dominio",$hasil);
if (ereg("Nada encontrado.", strtolower(trim($hasil[0])))) {
echo 'O dominio está disponível!';
} else {
echo 'O dominio não está disponível!';
}
} else {
echo 'Domínio inválido.';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment