stargate03 Posted August 1, 2007 Share Posted August 1, 2007 Hi all Not sure if this is easy or not I want to grab the first part of a subdomain ie rabbits.mysite.com i want to grab the word rabbit and put it in my page title how do i do this? Quote Link to comment https://forums.phpfreaks.com/topic/62823-solved-grabbing-part-of-a-subdomain/ Share on other sites More sharing options...
mrjcfreak Posted August 1, 2007 Share Posted August 1, 2007 For a full list of the server strings you can get; put this in somewhere: echo "<pre>"; print_r($_SERVER); echo "</pre>"; You can find the most appropriate one (probably $_SERVER['SERVER_NAME']) and then if neccesary chop it up using explode: e.g: list($subdomain,$domain) = explode(".",$_SERVER['SERVER_NAME']); Quote Link to comment https://forums.phpfreaks.com/topic/62823-solved-grabbing-part-of-a-subdomain/#findComment-312730 Share on other sites More sharing options...
stargate03 Posted August 1, 2007 Author Share Posted August 1, 2007 Excellent simple enough way - many thanks Quote Link to comment https://forums.phpfreaks.com/topic/62823-solved-grabbing-part-of-a-subdomain/#findComment-312749 Share on other sites More sharing options...
mrjcfreak Posted August 1, 2007 Share Posted August 1, 2007 Hmm. Something went wrong there with tags... should have been echo " <pre> "; print_r($_SERVER); echo " </pre> "; Quote Link to comment https://forums.phpfreaks.com/topic/62823-solved-grabbing-part-of-a-subdomain/#findComment-312791 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.