libtld is a library used to extract the TLD from a URI. This allows you to extract the exact domain name, sub-domains, and all the TLD (top level, second level, third level, etc.). The problem with TLDs is that you cannot know where the domain starts. Some domains can use one top-level domain, others use two, etc. However, it may be useful to know where the domain is to have the exact list of sub-domains. For example, if you want to force www. at the start of the domain name if no other sub-domains are specified, then you need to know exactly how many TLD are defined in a URI. The libtld offers one function: tld(), which gives you a way to extract the TLD from any URI. The result is the offset where the TLD starts. This gives you enough information to extract everything else you need.
| Tags | url C Library tld developement |
|---|---|
| Licenses | MIT/X |
| Operating Systems | Linux (32 and 64 bit) Mac OS X Win32/64 |
| Implementation | C C++ Qt 4 |
| Translations | English |
Recent releases


Release Notes: This release adds a C++ class to easily handle URIs in C++, adds a PHP extension so [check_]tld() can be used in PHP, adds a static version of the library, updates the TLDs as of Feb 2013, and fixes the TLD exceptions, which now return a valid answer.


Release Notes: Support for exceptions such as nic.uk. The tests have been update accordingly. A test for the XML file to make sure it respects the DTD has been added. This release fixes offsets in the data table, unsigned short and -1; it uses USHRT_MAX now. The .us entries are complete.


Release Notes: This release adds many TLDs as defined by the Public Suffix List. It has a new test to check data against the Public Suffix List. The existing tests have been updated to work with the new library. There is a new category called Entrepreneurial (i.e. official domain names used to resale sub-domains; i.e. .uk.com.)


Release Notes: Initial freecode announcement.