Programming Tips - PHP: Get the URL of the calling page

Date: 2008nov5 Update: 2024sep11 Language: php Q. PHP: Get the URL of the calling page A. Like this:
$calling_page = $_SERVER['HTTP_REFERER'];
Notice that its spelt wrong (for historical reasons) Should be "referrer" instead of "referer". Oh well, that's the way it is now. More info about this header field https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Referer