Score:0

How do I identify registerable/registered domains (ones with whois) and domains without whois (subdomains)

cn flag

I have an issue. I am trying to check if a given string is a valid "registered" or "registerable" domainname.

Ideally I want to see if the given string can have a valid "registrar" or not. I am already checking the string format using regex and returns true for:

  1. something.com
  2. something.com.au
  3. domains.google
  4. something.something.com

I want to be able to differentiate between "registerable" or "registered" domain from non-registerable or non-registered domain. And I want to do it without checking whois.

My application needs to accept both domains names and subdomain names. So my regex is just fine for that purpose. But I need to flag in my db if the entered value is subdomain or a domain for which I can find whois.

The whole point is to avoid hitting whois servers to retrieve information if the provided string is not a "registered" or "registerable" domain.

I did a lot of research and played around https://publicsuffix.org/list/public_suffix_list.dat but that isn't the solution. This is because for example "wixsite.com" is a valid public sufix, but it "something.wixsite.com" cannot have a whois.

mforsetti avatar
tz flag
why not use [any ready-to-use library](https://libraries.io/search?q=public+suffix) to do that?
in flag
It sounds like what you are looking for is something that checks for valid DNS names?
cn flag
Thanks, @mforsetti for pointing in the right direction. I am using https://libraries.io/packagist/utopia-php%2Fdomains
cn flag
@NiKiZe yes, I am.
Michael Hampton avatar
cz flag
It sounds like you want domains that appear in the whois, not registerable/registered domains (which, as you have discovered, do not always have whois records).
Patrick Mevzek avatar
cn flag
Typically only TLDs have whois servers attached to it (both registries and registrars). There are probably exceptions, but those would be rare edge cases not useful to take into account I posit. It all boils down to "The whole point is to avoid hitting whois servers to retrieve information": what kind of information are you trying to extract from whois output (and there are also TLDs without port 43 whois)? Also, look at RDAP, far better choice nowadays even if unfortunately not enough spread already.
Patrick Mevzek avatar
cn flag
"Ideally I want to see if the given string can have a valid "registrar" or not. " Why? Even at the TLDs level not all TLDs have a registry/registrar model (and even those that do have exceptions and domains registered directly at registry bypassing any registrar, see `de` for one example). A domain being registered or not, is not synonym for it having a registrar.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.