Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jun 2007
    Posts
    61
    Thanks
    13
    Thanked 0 Times in 0 Posts

    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!

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,802
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    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!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by knkk View Post
    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.
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #4
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If they're just html files (and correct me if I'm wrong)
    PHP Code:
    $contents fopen("http://example.co.in/page.htm""r");
    echo 
    $contents
    You can most likely do the same thing with PHP files.

  • #5
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by zDawg32 View Post
    If they're just html files (and correct me if I'm wrong)
    PHP Code:
    $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).
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #6
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Rowsdower! View Post
    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?

  • #7
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by zDawg32 View Post
    Ah. Well, are you the controller for both domains?
    Yes, the OP is in control of both sites:

    Quote Originally Posted by knkk View Post
    I have 2 sites, example.co.in and example.com, hosted on 2 different servers (I have all access details for both).
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #8
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Rowsdower! View Post
    Yes, the OP is in control of both sites:



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

  • #9
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Quote Originally Posted by zDawg32 View Post
    Well, then maybe (s)he should set example.com as an addon domain to example.co.in
    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." Is this different than what you mean?
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •