dominod Posted August 1, 2010 Share Posted August 1, 2010 For some reason this wont work.. Index is jsut returned blank ... Hmm Index.php : <?php include("http://www.website.com/cookie.php"); ?> Cookie.php: <?php if (isset($_COOKIE["background"])) $background = $_COOKIE['background']; else $background = " bgcolor='#FFFFFF'"; ?> It works perfectly if I just enter the code without using a include ... Quote Link to comment https://forums.phpfreaks.com/topic/209523-php-include-wont-work/ Share on other sites More sharing options...
Alex Posted August 1, 2010 Share Posted August 1, 2010 Including a file over HTTP won't get you the source code, only the output (which in your case is nothing). Try this: include("cookie.php"); Quote Link to comment https://forums.phpfreaks.com/topic/209523-php-include-wont-work/#findComment-1093897 Share on other sites More sharing options...
TheEddy Posted August 1, 2010 Share Posted August 1, 2010 Including a file over HTTP won't get you the source code, only the output (which in your case is nothing). Try this: include("cookie.php"); would it work if he had <?php include ("www.website.com/cookie.php"); ?> ??? Quote Link to comment https://forums.phpfreaks.com/topic/209523-php-include-wont-work/#findComment-1093904 Share on other sites More sharing options...
wildteen88 Posted August 1, 2010 Share Posted August 1, 2010 No, including a file with a url in any format will not work. This is because PHP will parse the included file separately and only include the output of that script. When including files you should use local file paths, as in Alex's example. Quote Link to comment https://forums.phpfreaks.com/topic/209523-php-include-wont-work/#findComment-1093906 Share on other sites More sharing options...
dominod Posted August 1, 2010 Author Share Posted August 1, 2010 Yes, of cource! Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/209523-php-include-wont-work/#findComment-1093917 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.