...

View Full Version : Displaying content from another site



knkk
06-18-2010, 12:13 PM
I have 2 sites, example.co.in and example.com, hosted on 2 different servers (I have all access details for both).

When someone accesses example.co.in/a/b.php?c=d, I want it to show the HTML of example.com/a/b.php?c=d

This site has to be search-engine-friendly, so I do not want to use an iframe, or even AJAX, since all the content has to be in the HTML - basically, example.co.in/a/b.php?c=d should output just the same HTML as example.com/a/b.php?c=d would.

I could use echo file_get_contents(example.com/a/b.php?c=d) in example.co.in, but that would mean a request goes from the example.co.in server to the example.com server, and then the output would come to the example.co.in server, which would then send it to the user. That could mean time delay, and also that I am using twice the bandwidth - since there is data transfer from both my servers.

Apache rewrite will change the URL, which I do not want to happen - I want people who browse example.co.in to stay on it.

I was wondering if any of the numerous experienced people on this forum would be able to suggest a solution . Thank you very much for your time!

abduraooft
06-18-2010, 12:45 PM
This site has to be search-engine-friendly, so I do not want to use an iframe, or even AJAX, since all the content has to be in the HTML - basically, example.co.in/a/b.php?c=d should output just the same HTML as example.com/a/b.php?c=d would.

I could use echo file_get_contents(example.com/a/b.php?c=d) in example.co.in, but that would mean a request goes from the example.co.in server to the example.com server, and then the output would come to the example.co.in server, which would then send it to the user. That could mean time delay, and also that I am using twice the bandwidth - since there is data transfer from both my servers.

Apache rewrite will change the URL, which I do not want to happen - I want people who browse example.co.in to stay on it.
AFAIK, there's no more way!

Rowsdower!
06-18-2010, 01:58 PM
I have 2 sites, example.co.in and example.com, hosted on 2 different servers (I have all access details for both).

When someone accesses example.co.in/a/b.php?c=d, I want it to show the HTML of example.com/a/b.php?c=d

This site has to be search-engine-friendly, so I do not want to use an iframe, or even AJAX, since all the content has to be in the HTML - basically, example.co.in/a/b.php?c=d should output just the same HTML as example.com/a/b.php?c=d would.

I could use echo file_get_contents(example.com/a/b.php?c=d) in example.co.in, but that would mean a request goes from the example.co.in server to the example.com server, and then the output would come to the example.co.in server, which would then send it to the user. That could mean time delay, and also that I am using twice the bandwidth - since there is data transfer from both my servers.

Apache rewrite will change the URL, which I do not want to happen - I want people who browse example.co.in to stay on it.

I was wondering if any of the numerous experienced people on this forum would be able to suggest a solution . Thank you very much for your time!

Are these sites set up on a CMS like Wordpress or Joomla or something?

If so, all you need to do is link them to the same database and site B will read site A's content natively (and vice versa, since they're using the same database - you could edit content from either site and it would impact both sites).

If not, then set up a CMS (or build your own) and do as above. That would be my best advice for this.

zDawg32
06-18-2010, 02:03 PM
If they're just html files (and correct me if I'm wrong)


$contents = fopen("http://example.co.in/page.htm", "r");
echo $contents;


You can most likely do the same thing with PHP files.

Rowsdower!
06-18-2010, 02:05 PM
If they're just html files (and correct me if I'm wrong)


$contents = fopen("http://example.co.in/page.htm", "r");
echo $contents;


You can most likely do the same thing with PHP files.

Yep, but OP said he didn't want to hit both servers like this for each request (performance and badnwidth concern).

zDawg32
06-18-2010, 02:13 PM
Yep, but OP said he didn't want to hit both servers like this for each request (performance and badnwidth concern).

Ah. Well, are you the controller for both domains?

Rowsdower!
06-18-2010, 02:24 PM
Ah. Well, are you the controller for both domains?

Yes, the OP is in control of both sites:


I have 2 sites, example.co.in and example.com, hosted on 2 different servers (I have all access details for both).

:D

zDawg32
06-18-2010, 03:28 PM
Yes, the OP is in control of both sites:



:D

Well, then maybe (s)he should set example.com as an addon domain to example.co.in:p

Rowsdower!
06-18-2010, 04:23 PM
Well, then maybe (s)he should set example.com as an addon domain to example.co.in:p

That may already be the case (OP hasn't given us enough info to tell for sure). Using the same hosting service does not guarantee that all of your sites will be on the same server. And what if the OP has paid for dedicated servers for each site?

Even so, having both sites under the same hosting service and on the same server isn't necessary and still wouldn't get the content from "site A" to appear on "site B" on its own. --- Unless I misunderstand your meaning of "addon domain (http://www.google.com/search?hl=en&defl=en&q=define:Addon+domain)." Is this different than what you mean?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum