TinyPortal

Development => Support => Topic started by: spellbyte on May 06, 2007, 11:09:43 PM

Title: Empty PHPblock
Post by: spellbyte on May 06, 2007, 11:09:43 PM
Hi guys,

well firstly a big thanks for such a great portal system, it rocks.

my problem is that i am trying to include an external .php file from one of my other sites but all i get is a empty box

this is the code i am using in the phpblock

include"http://mysite.com/banner.php";

i tried adding it as an Iframe in an HTML+BBC box, but iframes are crap, any ideas as to what could be preventing it from showing in the PHPblock
Title: Re: Empty PHPblock
Post by: Thurnok on May 06, 2007, 11:45:22 PM
Do not use URIs in include statements unless your php has been configured to allow external files in includes.  Instead, use a direct filepath to your file.  Example: include "/direct/path/to/my/htdocs/banner.php";
Title: Re: Empty PHPblock
Post by: spellbyte on May 06, 2007, 11:49:41 PM
as i said the file im trying to include is calling on a different server, have you a suggestion as to how can i resolve this
Title: Re: Empty PHPblock
Post by: Thurnok on May 07, 2007, 12:06:13 AM
There are a number of issues here you need to be aware of.  First, Windows versions of PHP prior to PHP 4.3.0 do not support accessing remote files via include.

Second, you have to make sure your PHP.INI file contains:
allow_url_fopen = 1
Which means you must be able to change the PHP.INI file.  Ok, if it is your own server, not going to happen if you have a host provider.

Third, the server that you are trying to "include" the file from will not simply give you the file as it sits on the server, unless that server does not run php files (going from your example of banner.php) through the php processor.  Instead, what would happen is the external server would "process" the "banner.php" file over there through the php processor on the external server and give you the "result" of that, not the actual file.  If you want the actual "file" then you have to turn off the php processor for .php files, or rename the file to something like "banner.php.txt".
Title: Re: Empty PHPblock
Post by: spellbyte on May 07, 2007, 12:51:44 AM
ok thanks for that, looks like i'll have to stick with Iframes