Posted by Toby A Inkster on 07/19/07 09:36
Toby A Inkster wrote:
> http://publicsuffix.org/list/
> If I get bored this evening I might have a go.
OK -- I've written a PHP class that is capable of extracting whichever
components you like out of a hostname, including its "effective TLD"
that is:
Host ETLD
--------------------------------------------
groups.google.co.uk. co.uk.
www.ealing.nhs.uk. nhs.uk.
www.ipart.nsw.gov.au. nsw.gov.au.
www.google.com. com.
www.last.fm. fm.
www.british-library.uk. uk.
del.icio.us. us.
The syntax for this is:
<?php
include "Domain.class.php";
$x = new Domain('www.ealing.nhs.uk');
echo $x->get_reg_domain()."\n"; // ealing.nhs.uk.
echo $x->get_etld()."\n"; // nhs.uk.
echo $x."\n"; // www.ealing.nhs.uk.
?>
Link to download is in my signature below...
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 28 days, 13:08.]
PHP Domain Class
http://tobyinkster.co.uk/blog/2007/07/19/php-domain-class/
Navigation:
[Reply to this message]
|