Hi,
I need to get the domain name from a URL. Examples:
google.com
images.google.com
new.images.google.com
www.google.com
should all return google.com
Also
google.co.uk
images.google.co.uk
new.images.google.co.uk
http://www.google.co.uk
should all return google.co.uk
I'm hesitant to use Regular Expressions, because something like domain.com/google.com could return incorrect results.
So, how can I get the top-level domain, using PHP? This needs to work on all platforms and hosts.
Thanks!