Over a month ago I published a function to extract Domain From URL in C++. I ported it to PHP and this code will extract Domain Name from Host Name or URL and will Contain Domain, TLD and maybe a Country Level TLD (2nd level TLD).