问题
I found a lot of threads explaining how to get the country-codes in two- or three-letter format, but nothing that fits to my task. I'm heading for a way to get all the top level domains in an array or something. I know there's the CultureInfo class in C# but which could list the country codes. It doesn't include generic TLD, e.g.: "com". Here's the complete list of country codes I found.
回答1:
The authoritative list of all TLDs: http://www.iana.org/domains/root/db
The Root Zone Database represents the delegation details of top-level domains, including gTLDs such as
.com
, and country-code TLDs such as.uk
.
You can get this as TXT, too (easier to parse): http://data.iana.org/TLD/tlds-alpha-by-domain.txt
Wikipedia also lists all TLDs, but it's not authoritative, of course: List of Internet top-level domains
The Mozilla Foundation maintains a Public Suffix List for effective top-level domains, i.e., those under which you can directly register names (for example .co.uk
instead of .uk
): http://publicsuffix.org/
回答2:
I like to use this list (it includes private TLDs): http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1. To me it's the most complete list I could find and it's in a plain text format.
来源:https://stackoverflow.com/questions/14427817/list-of-all-top-level-domains