获取包含内部链接的变量中的URL [重复]

I am getting my current page URL in variable using following code.

echo $url=$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
// Result: mywebsite/webpage.php

Everything goes well till here. But my webpage.php has some internal links. Which make URL like this

http://mywebsite/webpage.php#fragment-1

So when user is on this page and refresh page. I need to have fragment-1 in Result too but it shows same result as earlier. So how can I get '#fragment-1' value from url ?

</div>

You can't. Hashes do not get sent to the web server.