The TLD From a Domain Regex

Discussion in 'PHP' started by Kalyse, Jun 1, 2007.

  1. #1
    Hello,
    I am having problems in working out the extension/TLD from a domain. For example:

    Mydomain.com
    Mydomain.co.uk
    md.cc
    md.info
    md.museum
    md.com.au

    As you can see I dont think there is a general rule. Im not entirely sure, I cant quite see it if there is for always been able to calculate the TLD.

    I especially have problems where I have a subdomain from the domain. For instance,

    mysubdomain.site.com.au
    or
    mysubdomain.md.co.uk
    mysubdomain.md.cc

    These are just examples. Im not entirely sure if its even possible, I dont want to have my script need to compare against a list though.
     
    Kalyse, Jun 1, 2007 IP