Page 1 of 1

PHP Include wont work!?

Posted: Sun Aug 01, 2010 1:22 pm
by dominod
For some reason this wont work.. Index is jsut returned blank ... Hmm

Index.php :

Code: Select all

<?php
include("http://www.website.com/cookie.php");
?>
Cookie.php:

Code: Select all

<?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 ...

Re: PHP Include wont work!?

Posted: Sun Aug 01, 2010 1:55 pm
by PHPHorizons
Check the value of the php ini setting allow_url_fopen
http://www.php.net/manual/en/filesystem ... -url-fopen
http://us2.php.net/manual/en/function.include.php wrote:If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname.
Cheers

Re: PHP Include wont work!?

Posted: Sun Aug 01, 2010 3:31 pm
by superdezign
What ~PHPHorizons is suggesting is that, if these files are on your local server and not elsewhere, to use the local path and not the public URL.

Re: PHP Include wont work!?

Posted: Sun Aug 01, 2010 3:49 pm
by dominod
Of cource!

Thanks alot :drunk: