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? Link to comment https://forums.phpfreaks.com/topic/79605-solved-_server-help-i-think/ 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 Link to comment https://forums.phpfreaks.com/topic/79605-solved-_server-help-i-think/#findComment-403190 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? Link to comment https://forums.phpfreaks.com/topic/79605-solved-_server-help-i-think/#findComment-403200 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. Link to comment https://forums.phpfreaks.com/topic/79605-solved-_server-help-i-think/#findComment-403202 Share on other sites More sharing options...
LemonInflux Posted November 30, 2007 Author Share Posted November 30, 2007 ok, thanks. Topic solved. Link to comment https://forums.phpfreaks.com/topic/79605-solved-_server-help-i-think/#findComment-403205 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.