Allowing for slow XML feed

Discussion in 'PHP' started by Cobnut, Feb 6, 2008.

  1. #1
    I'm using an XML feed on a development site (it's news headlines) and it all seemed to be working fine but over the last couple of days the response from the foreign server has been very slow. This has meant my page 'hangs' for 5-10 seconds before complete rendering and obviously that's not good.

    The feed itself is very good and it's a valuable resource on the site so I don't want to lose it but equally I don't want my users to see it hang in this way. It's (hopefully) a temporary problem with their server but I need to put some kind of check in place in case it happens frequently.

    One option I'm considering is to check for a response within X seconds and fail to a message 'Not available' but that'll look a bit naff if it happens all the time!

    Has anyone solved a similar problem? I suppose one option is to move to JS and display a 'loading' marker while it does it in the background but I'd rather stick with PHP if possible.

    Jon
     
    Cobnut, Feb 6, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Try Magpie RSS, it has a cache function. This way you don't have to call the other server each time.
     
    nico_swd, Feb 6, 2008 IP