By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,420 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

How to determine current URL in PHP?

P: n/a
Is there a way that I can determine the current url/location (like the
'location' variable in javascript)? For example, if I'm at
http://mysite.com/index.php, is there perhaps a fixed variable
containing 'http://mysite.com/index.php' already available, or is
there a function available to retrieve it? I want to use this to log
certain hits on my site, so it would be nice to have a way to do it
all in one page rather than integrating information sent with the help
of javascript from another page.

Thanks in advance!

Jon
http://thewebdevelopment.com
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 6 Jul 2004 17:18:44 -0700, th***************@yahoo.com (Jonathan)
wrote:
Is there a way that I can determine the current url/location (like the
'location' variable in javascript)? For example, if I'm at
http://mysite.com/index.php, is there perhaps a fixed variable
containing 'http://mysite.com/index.php' already available, or is
there a function available to retrieve it? I want to use this to log
certain hits on my site, so it would be nice to have a way to do it
all in one page rather than integrating information sent with the help
of javascript from another page.


It's one of many variables set automatically. To find them all, put
this in your script:

phpinfo();

Put an exit(); after it if you don't want anything else in your script
to execute while your checking.

--
gburnore@databasix dot com
---------------------------------------------------------------------------
How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore | ۳ݳ޳ݳۺݳ޳ݳݳ޳ݳ۳
| ۳ݳ޳ݳۺݳ޳ݳݳ޳ݳ۳
DataBasix | ۳ݳ޳ݳۺݳ޳ݳݳ޳ݳ۳
| ۳ 3 4 1 4 2 ݳ޳ 6 9 0 6 9 ۳
Black Helicopter Repair Svcs Division | Official Proof of Purchase
================================================== =========================
Want one? GET one! http://www.databasix.com
================================================== =========================
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.