Michdd Posted August 30, 2009 Share Posted August 30, 2009 I found this function which gets the current URL. function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } I'm wondering if this will work inside an image script on a page? Or will it just return the URL of where the file is hosted? And if so, is it possible to get the URL of the page where the image is embedded? Quote Link to comment https://forums.phpfreaks.com/topic/172432-solved-self-url-inside-an-image/ Share on other sites More sharing options...
.josh Posted August 30, 2009 Share Posted August 30, 2009 can you give an example of what you're wanting to do? Quote Link to comment https://forums.phpfreaks.com/topic/172432-solved-self-url-inside-an-image/#findComment-909118 Share on other sites More sharing options...
Michdd Posted August 30, 2009 Author Share Posted August 30, 2009 I just want to get the URL of the page that an image is embedded on and check if the URL contains something. Quote Link to comment https://forums.phpfreaks.com/topic/172432-solved-self-url-inside-an-image/#findComment-909143 Share on other sites More sharing options...
.josh Posted August 30, 2009 Share Posted August 30, 2009 $_SERVER['HTTP_REFERER'] Quote Link to comment https://forums.phpfreaks.com/topic/172432-solved-self-url-inside-an-image/#findComment-909149 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.