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

Tony Crockford tonyc at boldfish.co.uk
Sat Dec 6 15:15:15 CST 2003


On Sat, 06 Dec 2003 13:21:46 -0700, Ken Moore <psm2713 at hotmail.com> wrote:

>
> Not so tricky at all. Assuming that there are a set number of top-level 
> domains (com, gov, net) and that there is a set number of characters 
> (".", I think is the only one) that begin the TL name, do a string 
> processing routine that looks for the "." and the TL domain such as 
> "com". Take those four characters and all of the ones back to the "."

Well that would work except for the .uk.com type domains and the recent 7 
new additions.

here's some of the trickier ones:


.co.uk
.org.uk
.me.uk
.com
.net
.org
.tv
.cc
.uk.com
.uk.net
.eu.com
.gb.com
.gb.net
.biz
.info
.name
.pro
.aero
.coop
.museum

couldn't you do a DNS look up and store the IP address instead?

http://uk.php.net/manual/en/function.gethostbyname.php

Maybe?


More information about the thelist mailing list