Re: Get current URL
| From: | David Robley | Date: | Mon, 09 Oct 2000 06:47:41 +0000 |
| Subject: | Re: Get current URL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19148@lists.php.net to get a copy of this message | ||
On Mon, 09 Oct 2000, Scott Poarch wrote:
> There must be an easy answer to this, but I can't find it:
>
> How do you set the complete URL of the current page to a variable? I know
> about PHP_SELF, but that only gives me part of the URL.
>
> Any help would be greatly appreciated.
> - - - - - - - - - - - - - -
> Scott Poarch
> GlobalHost.com
> - - - - - - - - - - - - - -
$SCRIPT_NAME will give you the relative URL, and you could prefix that with
http:// and $SERVERNAME like this:
$full_url = 'http://' . $SERVERNAME . $SCRIPT_NAME';
which will give you something like
http://www.this.server.com/path/to/script.php
Stick a phpinfo() in a script to see all the variables that are available.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA