Forum Moderators: coopster
<?php
// define the URL
$url = 'one.two.foo.com';// break it up using the "."
$urlb = explode('.',$url);// get the domain
$dns = $urlb[count($urlb)-2];// get the extension
$ext = $urlb[count($urlb)-1];put it back together
$fullDomain = $dns.'.'.$ext;
?>
If i find a simpler way il post it here, but this works with several subdomains, try it out =)
Hope i have hepled
Del
What if it is one.two.foo.co.uk? it only displays .co.uk and not foo.co.uk , you need some way of determining if the extension has more than one dot in it..
I think that the only way of doing this is having an array of extensions then searching through each of these to see if there is a match in your string, that way you will know how many dots there should be in the extension.