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 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. 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. 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 ^^ Link to comment https://forums.phpfreaks.com/topic/109897-solved-quick-question/#findComment-563909 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.