1// Warning: This can be manipulated by hackers!
2// If this is problematic, store the domain in a config file
3
4$currentDomain = $_SERVER['SERVER_NAME'];
1$url = 'http://google.com/dhasjkdas/sadsdds/sdda/sdads.html';
2$parse = parse_url($url);
3echo $parse['host']; // prints 'google.com'