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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Best way to read contents of remote file

    Hello CF

    I'm currently using get_file_contents to read the contents of an html file on another server. Is this the best way or should i be using curl or something else?

  • #2
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    That's perfectly fine.

    Just remember that each hit on your page, is a hit on their server.

    Consider caching the HTML.

    Code:
    if date of cached version is older than 1 day or cache does not exist
         download new version
         save to cache
    
    display cached version

  • #3
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok cool the only reason i ask though is because i already have CURL installed i was just wonderin if curl is better.

    Thanks

  • #4
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    It wouldn't really be. It would be helpful if you need to do something more than the basic 'fetch HTML'.


  •  

    Posting Permissions

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