you could either use urlparse() or a regex from http://stackoverflow.com/questions/3026957/how-to-validate-a-domain-name-using-regex-php