Jump to content

PHP Include wont work!?


dominod

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/209523-php-include-wont-work/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.