Snap! Websites
An Open Source CMS System in C++
The libtld was finally updated to include the newest world wide top-level domain names added in the last 12 months or so.
The library also better supports exceptions such as .uk and includes a few corrections.
Along those corrections came some additions to the documentation as we now support a C++ class which will really ease the use of the library for C++ programmers since it uses std::strings instead of char *. Although at this time it only supports UTF-8 strings.
The library also includes the necessary code to support a PHP extension so the power of the tld() function is now painlessly and fully available to PHP programmers. After including the php_libtld.php you can write code such as:
require('php_libtld.php'); $info = check_tld($uri); if($info['result'] == TLD_RESULT_SUCCESS && $info['status'] == TLD_STATUS_VALID && isset($info['tld'])) { echo "The URI [", $info['tld'], "]\n"; echo "The Domain [", substr($uri, 0, $info['offset']), "]\n"; }
This little script extracts the TLD and the rest of the sub-domains and domain name. But especially it shows that you can know that the TLD of the $uri variable is valid or not.
Finally, I added another function to check the validity of a complete URI with scheme, path, user name, password, port, query string, and anchor.
See: Project libtld
Snap! Websites
An Open Source CMS System in C++