websteve Posted May 20, 2007 Share Posted May 20, 2007 I am being told that php 5 has additional security when using the include function.. I ran some tests and found that I can only reference parameters that are in the same directory as the file that uses the include, but if I use absolute addressing, it doesn’t work. Here's the code: <?php include('logo.php'); ?> This works <?php include('http://long-island-real-estate-agency.com/HomesForSale/homes-frame.htm'); ?> This doesn't work How can I use include to reference external URLs? Thanks - Steve Quote Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/ Share on other sites More sharing options...
chigley Posted May 20, 2007 Share Posted May 20, 2007 You can't. But if it's just the output you're after (i.e. the HTML code on that page, which you want on your page) use something like this: <?php $homesframe = file_get_contents("http://long-island-real-estate-agency.com/HomesForSale/homes-frame.htm"); echo $homesframe; ?> Quote Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/#findComment-257478 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 Good advice from chigley echo chigley Quote Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/#findComment-257479 Share on other sites More sharing options...
wildteen88 Posted May 20, 2007 Share Posted May 20, 2007 I am being told that php 5 has additional security when using the include function.. I ran some tests and found that I can only reference parameters that are in the same directory as the file that uses the include, but if I use absolute addressing, it doesn’t work. Here's the code: <?php include('logo.php'); ?> This works <?php include('http://long-island-real-estate-agency.com/HomesForSale/homes-frame.htm'); ?> This doesn't work How can I use include to reference external URLs? Thanks - Steve Your are correct that php5 comes with additional security. As of PHP5.2 php has included a new setting called allow_url_include. This setting by default is disabled and thus you can not use the latter include. I would recommend chigley's suggestion for using file_get_contents. Quote Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/#findComment-257586 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 Cool never knew that.. Thank for the info, wild Quote Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/#findComment-257589 Share on other sites More sharing options...
websteve Posted May 20, 2007 Author Share Posted May 20, 2007 Cool! I will try file_get_contents(). That sounds like the way to go! Thanks to all! - Steve Quote Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/#findComment-257694 Share on other sites More sharing options...
MadTechie Posted May 20, 2007 Share Posted May 20, 2007 please click solved bottom left Quote Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/#findComment-257711 Share on other sites More sharing options...
wildteen88 Posted May 20, 2007 Share Posted May 20, 2007 please click solved bottom left Solved. Quote Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/#findComment-257712 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.