phpQuestioner Posted May 6, 2007 Share Posted May 6, 2007 Which predefined variables is it that will let me just echo the domain of the person who is visiting referred from? I know I can do this: $_SERVER['HTTP_REFERER']; but that will display the full address path. I want to only be able to see this: www.domain.com. I used to know how to do this; but I have forgotten how. Any body remember which predefined variable this is? Link to comment https://forums.phpfreaks.com/topic/50200-solved-predefined-variables-question/ Share on other sites More sharing options...
dzysyak Posted May 6, 2007 Share Posted May 6, 2007 Use parse_url PHP function to get the domain. Link to comment https://forums.phpfreaks.com/topic/50200-solved-predefined-variables-question/#findComment-246466 Share on other sites More sharing options...
phpQuestioner Posted May 6, 2007 Author Share Posted May 6, 2007 OK - I figured it out Thank You dzysyak <?php $fowarded = $_SERVER['HTTP_REFERER']; $url = "$fowarded"; $parts = parse_url($url); // use as needed // print "http://"; print $parts["host"]; ?> Link to comment https://forums.phpfreaks.com/topic/50200-solved-predefined-variables-question/#findComment-246479 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.