Vivid Lust Posted July 21, 2008 Share Posted July 21, 2008 Say i was on a page: http://www.mysite.com/dir/dir/index.php how would i get using php: http://www.mysite.com ??? Thanks in advanced for the help. Link to comment https://forums.phpfreaks.com/topic/115801-get-top-domain-name-with-php/ Share on other sites More sharing options...
matmunn14 Posted July 21, 2008 Share Posted July 21, 2008 Use $_SERVER["HTTP_HOST"] Link to comment https://forums.phpfreaks.com/topic/115801-get-top-domain-name-with-php/#findComment-595304 Share on other sites More sharing options...
-entropyman Posted July 21, 2008 Share Posted July 21, 2008 try this: <?php $url = 'http://www.google.com/'; print_r(pathinfo($url)); // all the arrays // or try $parts = pathinfo($url); echo "$parts[basename]"; // just array you want ?> http://us.php.net/manual/en/function.pathinfo.php Link to comment https://forums.phpfreaks.com/topic/115801-get-top-domain-name-with-php/#findComment-595320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.