/    Sign up×
Community /Pin to ProfileBookmark

Displaying content from another site

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!

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@TecBratJun 18.2010 — I'd suggest a combination of either file_get_contents (like you mentioned) or cURL, but develop a cacheing system where you only request the file from the other server once a day or once an hour, unless there is something that can't be cached. Other than that, you'd have to deal with the 2 requests and double bandwidth, afik.

TecBrat.
Copy linkTweet thisAlerts:
@knkkauthorJun 19.2010 — Thanks, TecBrat.
×

Success!

Help @knkk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...