SitePoint Sponsor

User Tag List

Results 1 to 24 of 24

Thread: Remote Include

  1. #1
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Remote Include

    I'm looking to include a remote file via include() but Wayne said it shoudn't be done.

    "Windows versions of PHP prior to PHP 4.3 do not support accessing remote files via this function, even if allow_url_fopen is enabled."

    My developer runs 4.2 and it works fine, though. Wayne suggested to use Javascript, but was he correct in his assessment? I'd like to use PHP if possible.

  2. #2
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes - it worked fine. Also, when doing a remote include like that, your accessing ONLY the HTML output.

  3. #3
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ryan, please stay out of this (he's my developer. Of _course_ he's putting his opinion in here!).

    http://php.he.net/manual/en/features.remote-files.php
    This is what I'm referring to. It's not completely supported.

  4. #4
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by geiger
    "Windows versions of PHP prior to PHP 4.3 do not support accessing remote files via this function, even if allow_url_fopen is enabled."
    AFAIK, that's true.
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  5. #5
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Want to explain why the windows servers i tried, worked?

  6. #6
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but I can't. Perhaps if you'd stop getting offended for a moment you'd realize that the results you provided conflict with a standard. Looking into the matter is not quite murder.

  7. #7
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Im offended for valid reasons. You wanted to make this as compatible as possible. Not all servers are going to have 4.3, correct, but also not all browsers are going to support JS or are going to have it enabled. I know plenty of people who have it turned off. That's where we meet. The majority of people will be running 4.3, and the majority of people will have JS enabled. I understand PHP.net and various other sources state that it doesnt work in < 4.3 , however, having tested it all night on various servers, i fail to see their validity. When you test something over and over again and it works perfectly, you begin to believe its right no matter what sources say. Any programmer can vouch for that. Just like alot of programmers, including i, have done things from valid sources that are supposed to work, and they dont.

  8. #8
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fine. Point taken. I'm going to see what some other SitePoint developers think and then will make a decision. Being informed isn't a crime.

    Now, lets set our flamethrowers aside and work this out maturely, please.

  9. #9
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What about fopen()?

  10. #10
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use readfile(), it will give you the same results on remote servers, and work with PHP <4.3.0 on Windows servers.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  11. #11
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So. Who wants to buy FileTrack?
    Aaron Brazell
    Technosailor



  12. #12
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do both vBulletin and SitePoint use javascript includes instead of readfile()?

  13. #13
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sitepoint is vbulletin ...

    "Powered by: vBulletin"

  14. #14
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, vBulletin's administration-end version check, & SitePoint's tip feed.

  15. #15
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got me, they probably have their reasons.

  16. #16
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Because it will work more often than a server-side call will.
    Mike
    It's not who I am underneath, but what I do that defines me.

  17. #17
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, okay. right on!

  18. #18
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Why do I recommend Javascript for this particular issue?

    1) It moves the responsibility to the client and therefore is less resources.

    2) If the server is down, the script will still work.

    3) It is not doing anything crucial.

    4) All servers will support it as well as all modern browsers.

    5) You can put it behind a secure socket layer and not require add-ons like CURL on the customers server.

    6) For the most part it is simple and easy to implement.
    Wayne Luke
    ------------


  19. #19
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    2) If the server is down, the script will still work.
    What server?

  20. #20
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    Obviously the one the script isn't on...
    Mike
    It's not who I am underneath, but what I do that defines me.

  21. #21
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by DoobyWho


    What server?
    your server.. You are running an include off your server on the clients server... Hence the remote server call. If your server is down (and all servers go down from time to time, it is unescapable) then the script doesn't work.... PERIOD.
    Wayne Luke
    ------------


  22. #22
    Bah, I'll just hack it DoobyWho's Avatar
    Join Date
    Jul 2002
    Posts
    476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the way i had the PHP programmed, if the server went down, or the file didnt exist, the script didnt work either :-p . But i'll support the decision to use js for this.

  23. #23
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Woa. After all that, you say JS is best, Ryan? lol, why?

  24. #24
    SitePoint Wizard geiger's Avatar
    Join Date
    Jul 2001
    Posts
    2,459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Duh! I'm so stupid. You can check if the "includes" worked by checking if the variables exist. There's one variable in each version.inc (included file), so one can go by that.

    lol


Bookmarks

Posting Permissions

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