I've been trying to work on this for a little while now using a combination of functions and ideas.
I am trying to get the domain from a url, which is easy enough if you want the sub-domain aswell, but i don't :/
Example
http://www.mydomain.com/dir/dir/index.html = mydomain.com
http://test.mydomain.com = mydomain.com
http://test.mydomain.co.uk = mydomain.co.uk
The main problem is that the domain extension could have 1 (.com,.net,.org etc..) or 2 (.co.uk, .ac.uk etc..) parts.
If anyone has managed to do something similar i would be really glad of the help.
Thanks very much, Craig