include page with domain

hello,
I have many domains and I would like to include a page
that if comes from domain1.com or domain2.com

make it like this

<? include("http://domain1.com/footer.php"); ?>

<? include("http://domain2.com/footer.php"); ?>

how can i do this?
SabrinAsked:
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'); ?>
0
 
HackneyCabCommented:
I'm not entirely clear on what you're asking.

If you want domain1.com to include the file domain1.com/footer.php, but domain2.com to include the file domain2.com/footer.php using the same code, then could you use this:

include('/footer.php');

That uses an absolute path that looks for footer.php in the root directory. So if the current script is in the space for domain1.com, then PHP should ask for domain1.com/footer.php 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.)
0
 
SabrinAuthor Commented:
<? include("DOMAIN WHERE YOU CAME FROM/footer.php"); ?>
0
 
SabrinAuthor Commented:
instead of  this
<? include($_SERVER["DOCUMENT_ROOT"]."/galleries/main/header.php"); ?>
/home/etc/site/galleries/main/header.php

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

I need the http://
0
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.