|
Posted by Justin Koivisto on 01/10/06 16:57
Oli Filth wrote:
> Venturer said the following on 10/01/2006 09:52:
>
>> I have a banner script that is included in php on a website but the
>> actual script is hosted on a different site allowing me to only edit
>> one file to update the script.
>>
>> I need to store in a variable the hostname that the included script is
>> being run on NOT the master url where it is hosted.
>
>
> I'm assuming you're include()-ing the script as something like:
>
> include("http://remote.server.example.com/script.php");
>
> Is the remote server set to execute PHP or not?
>
> * If it is, then script.php is being run on the remote server, not the
> local server, so you're actually include()-ing the *output* of
> script.php, not the PHP code itself. In which case, you will need to
> either pass the hostname in the request for script.php, e.g.:
>
> include("http://remote.server.example.com/script.php?host=http://local.example.com/mainscript.php");
This is something that I have never done (include from another
server/domain)...
Out of curiosity, does the $_GET array actually get populated with
values sent in this way for the remote script? When I want that
behavior, I usually use something like curl to send the request and
receive the output.
I know that if you do something like:
include 'myfile.php?var=val1';
That php looks for a file with that exact name (which will not exist in
most cases). Therefore in order to make that work (locally anyway),
you'd need to set the variable before the file was included.
--
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
[Back to original message]
|