paulman888888 Posted June 12, 2008 Share Posted June 12, 2008 I would like a script to get the full url of a page. eg http://something.com/somefolder/somefile.php and the php script would pick up the full url from http all the way to .php. Please can you help Thankyou Quote Link to comment https://forums.phpfreaks.com/topic/109897-solved-quick-question/ Share on other sites More sharing options...
conker87 Posted June 12, 2008 Share Posted June 12, 2008 echo $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']; Should work. Quote Link to comment https://forums.phpfreaks.com/topic/109897-solved-quick-question/#findComment-563899 Share on other sites More sharing options...
Daniel0 Posted June 12, 2008 Share Posted June 12, 2008 echo 'http' . ($_SERVER['SERVER_PORT'] == 443 ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . (!in_array($_SERVER['SERVER_PORT'], array(80, 443)) ? ':' . $_SERVER['SERVER_PORT'] : '') . $_SERVER['REQUEST_URI']; Edit: Fixed syntax error. Quote Link to comment https://forums.phpfreaks.com/topic/109897-solved-quick-question/#findComment-563904 Share on other sites More sharing options...
conker87 Posted June 12, 2008 Share Posted June 12, 2008 Or that ^^ Quote Link to comment https://forums.phpfreaks.com/topic/109897-solved-quick-question/#findComment-563909 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.