Reading a Remote File Using PHP - Is it good or not?

Discussion in 'Programming' started by profitdollar, Oct 21, 2008.

  1. #1
    Hi guys... I need your opinion about this topic.

    I want to use the code below to include a specific file (ex: terms.php) to all my web pages located on various servers.

    Case:

    Let say I have 3 servers, A, B and C.

    Then I have 3 different sites in server A, B and C.

    Each sites will have same navigation at the end of the page which I will create a navigation.php file and place it on server A.

    Then, I will use those code to get the navigation.php content from server A to appear on all of my web pages (in server A, B and C).

    So, what I do want to know is this method is really effective? Does this method will affect my web page loading time?

    I used to use ssi method but I want to know is this method is more efective than ssi?

    The reason of using this method is, I want to easily change some of the content especially for the terms/navigation/offers in all my webpages.

    Thank you for your response.

    -A.Z
     
    profitdollar, Oct 21, 2008 IP
  2. ToddMicheau

    ToddMicheau Active Member

    Messages:
    183
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Your navigation.php is on a separate server than what your running your other pages from? Odd, but okay.

    Yes, this will effect the page load time, as the php script needs to wait for a reply and content from the other server. Though if your server is configured right and doesn't load slowly then this wait time might not be too bad. Though that times 3 (your loading from 3 different servers, yea?) might get a little annoying for users.

    You may want to consider putting all your php files on your own server.

    Or consider an ajax framework. . .
     
    ToddMicheau, Oct 22, 2008 IP
  3. profitdollar

    profitdollar Active Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    63
    #3
    Thanks ToddMicheau!

    I do what you've suggested where I put the main file to include (ex: filename.php) in each servers.

    By the way, I'm not using file_get_contents anymore. I just changed it to include method.

    Thanks again!
     
    profitdollar, Oct 23, 2008 IP