mkosmosports Posted September 27, 2007 Share Posted September 27, 2007 Hey. Take for example this url: http://weblogtoolscollection.com/regex/regex.php I want to get "weblogtoolscollection.com" out. Im very unfamiliar with regex, but it seems like its the only option. Anyone want to help me out? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/70819-getting-domain-name-out-of-url/ Share on other sites More sharing options...
teng84 Posted September 27, 2007 Share Posted September 27, 2007 try echo $_SERVER['HTTP_HOST']; Quote Link to comment https://forums.phpfreaks.com/topic/70819-getting-domain-name-out-of-url/#findComment-356068 Share on other sites More sharing options...
trq Posted September 27, 2007 Share Posted September 27, 2007 <?php echo parse_url('http://weblogtoolscollection.com/regex/regex.php', PHP_URL_HOST); ?> Quote Link to comment https://forums.phpfreaks.com/topic/70819-getting-domain-name-out-of-url/#findComment-356124 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.