$url = "http://domain.com/path1/index.html";
$ParsedUrl = parse_url($url);
echo $ParsedUrl['host'];
parse_url() returns an associative array containing the different elements of a url.
Look under URL Functions/pares_url() in the PHP manual for the keys returned with the assocative array.