Page 1 of 1

include class from remote site

Posted: Tue Oct 31, 2006 1:15 am
by webstyler
Hi

I must include a file that contain a class from remote site.

If I include as .php (include "http://www.**.com/myclass.php) don't work as processed as php

If I include as .inc (include "http://www.**.com/myclass.inc) is ok

BUT

if user visit http://www.**.com/myclass.inc can view my class in the browser and I need that this class is not public and not visibile..

any help ?

thx

Posted: Tue Oct 31, 2006 1:21 am
by ohlaph
have you tried using require instead of include?

Posted: Tue Oct 31, 2006 1:42 am
by webstyler
yes, nothing change

:/

Posted: Tue Oct 31, 2006 8:43 am
by feyd
If the remote parses PHP, there will be no PHP code to return to your local site unless it outputs PHP code itself. Either way, remote inclusion is often a dangerous operation.

Posted: Tue Oct 31, 2006 8:53 am
by kaszu
If you don't want anyone to see the code of the file you want to include you can do following:
create one more file: myclass2.php
If this file is accessed using "?get=some_secret_code", then output the content of myclass.php using "echo file_get_contents('myclass.php');"

To include the class from remote server use:
include('http://.../myclass2.php?get=some_secret_code');