How can I get the current page’s full URL on a Windows/IIS server?

Solution:1

Maybe, because you are under IIS,

$_SERVER[‘PATH_INFO’]
is what you want, based on the URLs you used to explain.

For Apache, you’d use $_SERVER[‘REQUEST_URI’].

Solution:2

$pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
if ($_SERVER["SERVER_PORT"] != "80")
{
    $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} 
else 
{
    $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;