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 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; ?> 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 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. 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 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 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 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. Link to comment https://forums.phpfreaks.com/topic/52205-solved-include-function/#findComment-257712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.