There could be a good way to do this if all the document roots are in the same place.. I.E. C:\web\domian
if that is true,
$Temp = split("\",$_SERVER["PATH_TRANSLATED"]);
$DOCUMENTROOT = "C:\web\".$Temp[2];
But at any rate I am sure you can do it somehow with Regex.