Tag Archives: Top Level

[PHP] TLD List, Inc. Level 2 & 3

Whilst working on a new open-source project I needed to be able to be able to detect/remove the TLD’s from hostnames. This is no easy task algorithmically as example.co.uk (level 2) is just as valid as example.com (level 1) which is also just as valid as example.bob.shiga.jp (level 3). I came across a project from Mozilla that lists all TLDs. This isn’t the easiest format to work with each time you want to test hostnames. So I’ve built an auto-updater that will sort and serialize the domains into a format like:
Continue reading [PHP] TLD List, Inc. Level 2 & 3