LemonInflux Posted November 30, 2007 Share Posted November 30, 2007 I'm currently working on a project that can easily be integrated into a website. The way I'm doing this is as follows: I'm (trying to) get the path to the page I'm using, so when you go to a different page, I can do: *Current_file_path*?randomthing=value, or whatever. So, I can build URLs like: site.com/index.php?page=article&comment=true&id=90&lite=false The only problem I'm having is getting the path. I looked at SCRIPT_FILENAME, but that gives the absolute (e:\domains\s\site.com/index.php or whatever), which presumably wouldn't work. So, what I'm basically asking is, would this work, or is there another way to do this? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 30, 2007 Share Posted November 30, 2007 have you tried: <?php print_r($_SERVER); ?> When you view this, view the source file, it is easier to read Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted November 30, 2007 Author Share Posted November 30, 2007 REQUEST_URI SCRIPT_NAME PHP_SELF seem to have come the closest, but they don't include the domain name. Could I use, say: $domain = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; to get the full usable path? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 30, 2007 Share Posted November 30, 2007 This will work: $domain = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; if that is what you are looking for, for out put. Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted November 30, 2007 Author Share Posted November 30, 2007 ok, thanks. Topic solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.