monkeytooth Posted March 24, 2008 Share Posted March 24, 2008 I'm fried, my head hurts, and I should sleep.. but I wanna do this one thing before I forget to something im working on.. I just want to get the www.domain.com from the domain the script is hosted on and echo it out.. I just can't think of the proper way to do it, well can't seem to recall the proper function name rather. I know one exists, but can't just google it without getting 100000000000000000000 results in the effect to something thats not relative to what I want. Someone wanna help out this burnt out bum.. Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/ Share on other sites More sharing options...
rhodesa Posted March 24, 2008 Share Posted March 24, 2008 You just want to get the contents of a remote webpage? Any file handling function will do: $contents = file_get_contents("http://www.domain.com"); Note...this will give you the generated contents, not the PHP code that generated it. Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499668 Share on other sites More sharing options...
alexL Posted March 24, 2008 Share Posted March 24, 2008 You mean like echo file_get_contents('http://www.domain.com'); echo file('http://www.domain.com'); Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499672 Share on other sites More sharing options...
tippy_102 Posted March 24, 2008 Share Posted March 24, 2008 Maybe I am not understanding what you want, but here's my take on it: $host = $_SERVER['HTTP_HOST']; Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499697 Share on other sites More sharing options...
monkeytooth Posted March 24, 2008 Author Share Posted March 24, 2008 tippy thats it.. funny thing to, thought I was doing it wrong.. cause i was just trying to echo it out as a simple link.. and couldnt get it to echo right.. kept putting the domain/folder/the the domain again.. This should tell you how much sleep it is i need, I forgot to add the http:// part to echo as well, so the browser took the request and thought I was tryin to do something dynamic with it rather then just make a simple link.. damn im good! putting the http part in the link tag made it work.. I think im goin to sleep.. who knows, maybe time for coffee.. bah.. thanks you guys for the responces Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499731 Share on other sites More sharing options...
Agtronic Posted March 24, 2008 Share Posted March 24, 2008 Not that I can add anything helpful, but I do understand how it feels to be wired all night and then stuck on a stupid little thing that should be so simple. Sometimes I look at my code the following morning and wonder what the hell I was thinking. Hehehe! Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499751 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.