use $REQUEST_URI this will give you the URL user entered to read to the file.
then use explode to seperate the URL by #. e.g.
$value = explode('#', $REQUEST_URI);
so, $value[0] will contain /test/index.php
and $value[1] will contain someanchor
hope that helps.
Daarius...