Posted by Andy Hassall on 10/06/06 22:36
On 6 Oct 2006 15:30:18 -0700, "Victor" <big.boss@chefmail.de> wrote:
>could anybody explain the following phenomen :
>
>I have this line in my project :
>
>include
>"http://".$domain."/help/".$language."/".$defaultIndex."/".$help.".php";
>
>This construct properly includes the file I need to. And the included
>file contains the following line :
>
>echo $domain;
>
>- and on this place comes nothing: obviously, the variable '$domain' is
>not set for the <help.php>.
>
>Why ?
How are you expecting it to be set? You're (almost certainly) executing the
remote PHP file in a totally different context - all you're include()ing is the
output of the PHP file from the remote server.
The only way it could work is if the webserver you're calling returns the PHP
source verbatim, without processing it, in which case it's run in the same
context as the calling script.
Are you sure you want to be doing remote HTTP includes? Including from the
filesystem is by far the more common usage, and is more likely to behave how
you expect.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
[Back to original message]
|