| | |||||
| ||||||||
| CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: May 2005 Location: England
Posts: 390
![]() ![]() ![]() | [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), distinguising between what a sub-domain is and a domain that just has a really long ending is difficult. Long story short I've created a quick script that will process the list from Mozilla into a serialized PHP accessible format. You could then use this list array to check for matches in a domain name for example. PHP Code: I've put a fuller explanation of how to use the list on my blog at [PHP] TLD List, Inc. Level 2 & 3*/* Beaver6813.comIf it helps you, Rep appreciated!
__________________ -Beaver6813.com - Web Developer Extraordinaire! |
| | |