You are here: Re: php extract variable from a string using regexp « PHP Programming Language « IT news, forums, messages
Re: php extract variable from a string using regexp

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация