[thelist] PHP: getting domain names from a url - being foiled by .co.uk addresses

Dunstan Orchard dunstan at 1976design.com
Sat Dec 6 13:49:19 CST 2003


Hey Manuel,
Manuel González Noriega wrote:
> not a full answer but can't you just explode($host)  on '.', rather  
> than using strpos(),
> that way you can count() the elements of the resulting array and act 
> accordingly.

well, I could explode it, yes (though I think it would be a bit messier 
wouldn't it?), but I'd still be left without knowing what's a subdomain, 
and what's a... bit at the end (what are the .com, .net, .co.uk things 
called?) - what to keep and what to discard.

:o/

> Boy, i love to talk() like this ;)

hee :o)

-------------------------------------
Dorset, England
Work: http://www.1976design.com/
Play: http://www.1976design.com/blog/
Learn: http://webstandards.org/




More information about the thelist mailing list