peranha Posted March 6, 2008 Share Posted March 6, 2008 I was woundering how do I just get the domain from the URL. $SERVER['http_referer'] will give me http://www.phpfreaks.com/forums/index.php?action=post;board=1.0 I just want http://www.phpfreaks.com Anyone know how this can be done with PHP preferably. Link to comment https://forums.phpfreaks.com/topic/94810-solved-http_referer/ Share on other sites More sharing options...
rofl90 Posted March 6, 2008 Share Posted March 6, 2008 me too I need to know that Link to comment https://forums.phpfreaks.com/topic/94810-solved-http_referer/#findComment-485569 Share on other sites More sharing options...
peranha Posted March 8, 2008 Author Share Posted March 8, 2008 Anyone know of a way of doing this? Link to comment https://forums.phpfreaks.com/topic/94810-solved-http_referer/#findComment-486737 Share on other sites More sharing options...
laffin Posted March 8, 2008 Share Posted March 8, 2008 parse_url Link to comment https://forums.phpfreaks.com/topic/94810-solved-http_referer/#findComment-486739 Share on other sites More sharing options...
peranha Posted March 8, 2008 Author Share Posted March 8, 2008 that gives me this Array ( [scheme] => http [host] => www.phpfreaks.com [path] => /forums/index.php/topic,186086.0/topicseen.html ) /forums/index.php/topic,186086.0/topicseen.html How do I get the host portion of the array. I have tried echo parse_url($url, [host]); echo parse_url($url, host); None work. I got it fixed, just going at it wrong. This is what I came up with. echo parse_url($url, PHP_URL_HOST); Link to comment https://forums.phpfreaks.com/topic/94810-solved-http_referer/#findComment-486747 Share on other sites More sharing options...
laffin Posted March 8, 2008 Share Posted March 8, 2008 Congrats Link to comment https://forums.phpfreaks.com/topic/94810-solved-http_referer/#findComment-486774 Share on other sites More sharing options...
peranha Posted March 8, 2008 Author Share Posted March 8, 2008 Congrats Yeah, thanks for the push in the right direction. Link to comment https://forums.phpfreaks.com/topic/94810-solved-http_referer/#findComment-486777 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.