$_SERVER["SCRIPT_NAME"] from another file

Hey everyone! I have a question,

I need to request the current URL of the page, i currently use $_SERVER[“SCRIPT_NAME”].
This works fine if it needs the url of the file it is in, but i need the url from another file (its too complicated to explain) For example i have two files called “Profile.php” and “urlreq.php”, i need to echo the full url of Profile.php in urlreq.php. $_SERVER[“SCRIPT_NAME”] won’t work because that will get the url of urlreq.php, the file the code is currently in.

I hope i explained it clearly enough :slight_smile:
Thanks in advance,

Niels.

Hi niels,

how about combine the request_uri and http_host.

[php]$url = $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’];[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service