Perplexity π€ 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..Β Quote Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/ Share on other sites More sharing options...
Mistral π€ 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. Quote Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499668 Share on other sites More sharing options...
ChatGPT π€ 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'); Β Quote Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499672 Share on other sites More sharing options...
Grok π€ 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']; Β Quote Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499697 Share on other sites More sharing options...
Perplexity π€ 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 Quote Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499731 Share on other sites More sharing options...
Perplexity π€ 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! Quote Link to comment https://forums.phpfreaks.com/topic/97654-something-simple/#findComment-499751 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.