Hi Brad,

Wednesday, June 6, 2007, 5:04:41 PM, you wrote:

> Yes, that's basically what my code already does.

> The problem is that what if the url is "http://yahoo.co.uk/"; (note the lack
> of a subdomain)

> Your script thinks that the domain is "co.uk".  Just like my existing code
> does.

> So we can't count on taking the last 2 segments.  And we can't count on
> ignoring the first segment.  (The subdomain could be anything, not just www)

The complete list of top-level domains is neither very long, nor
changes very often. Perhaps a new country/suffix now and again is added or
renamed, but it doesn't happen that much.

In short, I think it'd be much better for you to obtain a full list
and then just remove that element from your hostname. Then you'll know
for a fact that whatever is left is the pure domain (+ sub-domain).

Of course it won't help if someone gives you the IP of a site (or any
other similar variation) instead of a domain name :)

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to