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

Ken Moore psm2713 at hotmail.com
Sat Dec 6 18:07:03 CST 2003

Tony Crockford wrote:

>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:
>couldn't you do a DNS look up and store the IP address instead?

Of course you are right. These examples were not amoung the given ones. But 
that avoids the valid point brought up by you. And this will be more true as 
DNS's become more diverse and less predictable. Your solution seems better. 
Do a look up, get the IP address and then do a reverse look up to get the 


Take advantage of our best MSN Dial-up offer of the year — six months 
@$9.95/month. Sign up now! http://join.msn.com/?page=dept/dialup

More information about the thelist mailing list