metalwyrm Posted June 27, 2008 Share Posted June 27, 2008 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 More sharing options...
waynew Posted June 27, 2008 Share Posted June 27, 2008 Would placing $_SERVER['SERVER_NAME'] in script.php not work? Link to comment https://forums.phpfreaks.com/topic/112190-server-name/#findComment-575938 Share on other sites More sharing options...
Jabop Posted June 27, 2008 Share Posted June 27, 2008 Set a variable in the script.php and use it on the included page. Link to comment https://forums.phpfreaks.com/topic/112190-server-name/#findComment-575954 Share on other sites More sharing options...
metalwyrm Posted June 27, 2008 Author Share Posted June 27, 2008 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 More sharing options...
br0ken Posted June 27, 2008 Share Posted June 27, 2008 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 More sharing options...
metalwyrm Posted June 28, 2008 Author Share Posted June 28, 2008 I'm not sure I can include remote scripts, and even pass variables to them and have the script $_GET the variables ....lol I think I just found a solution to my problem Link to comment https://forums.phpfreaks.com/topic/112190-server-name/#findComment-576588 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.