What is the best way to programaticly validate a domain name?
At first I was thinking, easy, just need to make sure it's in format "word.ext"
Then I just make sure that word and ext don't use any special characters.
If it's www.word.ext then it is invalid because there's 3 sections, I only want 2. (don't care about subdomains in this particular case)
But here's my delima. There are domain TLDs like co.uk.
So how would I handle that? Do I need to tell my program what every single domain extension is? How do programs like cpanel do it?
At first I was thinking, easy, just need to make sure it's in format "word.ext"
Then I just make sure that word and ext don't use any special characters.
If it's www.word.ext then it is invalid because there's 3 sections, I only want 2. (don't care about subdomains in this particular case)
But here's my delima. There are domain TLDs like co.uk.
So how would I handle that? Do I need to tell my program what every single domain extension is? How do programs like cpanel do it?
