include page with domain

I have many domains and I would like to include a page
that if comes from or

make it like this

<? include(""); ?>

<? include(""); ?>

how can i do this?
Who is Participating?
HackneyCabConnect With a Mentor Commented:
Is there a reason why you can't add that scheme in your code:

<? include('http://'.$_SERVER["HTTP_HOST"].'/galleries/main/header.php'); ?>
I'm not entirely clear on what you're asking.

If you want to include the file, but to include the file using the same code, then could you use this:


That uses an absolute path that looks for footer.php in the root directory. So if the current script is in the space for, then PHP should ask for and so on. I think that would work even if the domains were on the same server. (So long as the domains didn't point to the same directory.)
SabrinAuthor Commented:
<? include("DOMAIN WHERE YOU CAME FROM/footer.php"); ?>
SabrinAuthor Commented:
instead of  this
<? include($_SERVER["DOCUMENT_ROOT"]."/galleries/main/header.php"); ?>

i want something like this
<? include($_SERVER["DOMAIN"]."/galleries/main/header.php"); ?>
SabrinAuthor Commented:
<? include($_SERVER["HTTP_HOST"]."/galleries/main/header.php"); ?>
only shows this

I need the http://
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.