Created
July 16, 2014 12:18
-
-
Save dinego/132f9b7c357c94615122 to your computer and use it in GitHub Desktop.
Função que checa domínio com php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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