Sometimes maybe you need to get a domain name from a URL string. Here is the code
1 2 3 4 5 6 7 8 9 10 11 12 | function GetDomain($url) { $nowww = ereg_replace(’www.’,”,$url); $domain = parse_url($nowww); if(!empty($domain["host"])) { return $domain["host"]; } else { return $domain["path"]; } } |
