samtay Posted July 20, 2007 Share Posted July 20, 2007 Hey Everyone, How can I get the domain from $_SERVER['HTTP_REFERER']. For Example: If $_SERVER['HTTP_REFERER'] = http://example.com/somepage/2 then I only want example.com. Also If $_SERVER['HTTP_REFERER'] = http://www.example.com/somepage/2 then I only want example.com, this also apply to other sub domains too. Cheers Samuel Link to comment https://forums.phpfreaks.com/topic/60956-solved-domain-from-_serverhttp_referer/ Share on other sites More sharing options...
chigley Posted July 20, 2007 Share Posted July 20, 2007 parse_url() Should do the trick Link to comment https://forums.phpfreaks.com/topic/60956-solved-domain-from-_serverhttp_referer/#findComment-303279 Share on other sites More sharing options...
samtay Posted July 20, 2007 Author Share Posted July 20, 2007 Cheers for the reply, would this give me the sub domain? Samuel Link to comment https://forums.phpfreaks.com/topic/60956-solved-domain-from-_serverhttp_referer/#findComment-303280 Share on other sites More sharing options...
chigley Posted July 20, 2007 Share Posted July 20, 2007 Not sure, give it a go and see! Link to comment https://forums.phpfreaks.com/topic/60956-solved-domain-from-_serverhttp_referer/#findComment-303282 Share on other sites More sharing options...
samtay Posted July 20, 2007 Author Share Posted July 20, 2007 Thanks for helping Samuel Link to comment https://forums.phpfreaks.com/topic/60956-solved-domain-from-_serverhttp_referer/#findComment-303295 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.