I'm implementing my first xml feed for a project - while this paid-for feed is unlikely to go down I need to know how to deal with this eventuality in case it does happen.
First thing I need to do - of course - is to somehow detect that the feed is unavailable. The author of the feed reports to me that if it does go down I would get a Time Out or Server Unavailable message.
I've never done error trapping for someone else's content so I'm wondering exactly how to capture these two possible messages. Would it be likely (I haven't asked the provider but probably should) that rather than an XML document I would simply get a "Time Out" or "Server Unavailable" text string?
Interested in knowing how the pros do this and greatly appreciate any information and guidance.
You can check the response headers if that would help. If you get anything other than a 200/OK code, you could take other actions.
Look into cURL [php] for this. You should be able to grab the headers without the content body, and then you'd just check against that. At least that's what I would do. Unless the feed you are grabbing data from has something specific that could happen where you would get an OK status but there'd be no content there.