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 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']; 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); ?> 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
Archived
This topic is now archived and is closed to further replies.