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. Quote Link to comment Share on other sites More sharing options...
rofl90 Posted March 6, 2008 Share Posted March 6, 2008 me too I need to know that Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
laffin Posted March 8, 2008 Share Posted March 8, 2008 parse_url Quote Link to comment 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); Quote Link to comment Share on other sites More sharing options...
laffin Posted March 8, 2008 Share Posted March 8, 2008 Congrats Quote Link to comment 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. Quote Link to comment 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.