Deivas Posted March 7, 2010 Share Posted March 7, 2010 Is it possible to add a website on a page, like include 'blah.php'; ? Because if I try to do include I get millions of errors that a file doesn't exist. Quote Link to comment https://forums.phpfreaks.com/topic/194441-is-it-possible/ Share on other sites More sharing options...
Psycho Posted March 7, 2010 Share Posted March 7, 2010 include() is used to include PHP code - not html. Use file_get_contents() to get the html code of the html code and echo it out. Quote Link to comment https://forums.phpfreaks.com/topic/194441-is-it-possible/#findComment-1022751 Share on other sites More sharing options...
Anti-Moronic Posted March 7, 2010 Share Posted March 7, 2010 Yeh, it can include local php files. You can include and run remote php files by using eval: eval(file_get_contents('http://host.com/remotefile.php')); Of course I wouldn't suggest you do this unless you have absolute control over the remote file and it is the only way to reference the code. Also, you might want to try cURL, that can do some pretty incredible stuff. Quote Link to comment https://forums.phpfreaks.com/topic/194441-is-it-possible/#findComment-1022797 Share on other sites More sharing options...
Psycho Posted March 8, 2010 Share Posted March 8, 2010 Yeh, it can include local php files. You can include and run remote php files by using eval: eval(file_get_contents('http://host.com/remotefile.php')); That will not work. When file_get_contents() calls an external php file the web server will parse that php file and return the processed results (i.e. the rendered html code), it will not return the PHP code. Quote Link to comment https://forums.phpfreaks.com/topic/194441-is-it-possible/#findComment-1022870 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.