To get just myserver.com out of www.myserver.com/rest/of/path, try the folllowing:
<?
$url = "www.myserver.com/rest/of/path";
$var = parse_url($url);
$domain = $var['host'];
// the variable $domain now contains only www.myserver.com
$domain = split(".", $domain, 2)
// $domain is now an array containing 'www', 'myserver', and 'com' in separte elements
// to get the final product:
$end_result = $domain[1].'.'.$domain[2];
// $end_result is equal to myserver.com
?>
Hope this helps!!
Cheers,
Geoff