Jump to content

server name


metalwyrm

Recommended Posts

Hey,

 

example:

 

I've got a script on domain1.com

let's say www.domain1.com/script.php

 

another script, on domain2.com

let's say www.domain2.com/test.php

has <? include("http://www.domain1.com/script.php"); ?>

 

this all works out fine except that I want to use something like:

$_SERVER['SERVER_NAME']

in script.php, but instead of displaying the domain where the script is located, I want it to display the domain which is including the script

 

Thanks in advance for any help

Link to comment
https://forums.phpfreaks.com/topic/112190-server-name/
Share on other sites

Would placing $_SERVER['SERVER_NAME'] in script.php not work?

 

tried that already, it shows the domain where the script is located

 

Set a variable in the script.php and use it on the included page.

 

I would like to have script.php be able to pick up the domain is being included from

Link to comment
https://forums.phpfreaks.com/topic/112190-server-name/#findComment-576326
Share on other sites

The way I thought it works is whenever a script is requested, the server passes it to the PHP parser which then returns HTML to who ever requested it. Therefore you wouldn't be able to set a variable in one script and have a script on another server access it.

 

I could be wrong, I haven't tested this as I have access to only server but this was how I thought it worked.

I thought this because I've always been told it's impossible to actual access the code of a PHP script that isn't on your server.

Link to comment
https://forums.phpfreaks.com/topic/112190-server-name/#findComment-576368
Share on other sites

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.