homepage Welcome to WebmasterWorld Guest from 54.145.183.169
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Detecting Time Out and Server Unavailable Messages
neophyte

10+ Year Member



 
Msg#: 4016626 posted 1:59 am on Oct 31, 2009 (gmt 0)

Hello All -

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.

Neophyte

 

eelixduppy

WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4016626 posted 10:13 pm on Nov 9, 2009 (gmt 0)

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.

OutdoorWebcams

5+ Year Member



 
Msg#: 4016626 posted 10:33 am on Nov 10, 2009 (gmt 0)

Sorry eelixduppy, this is the correct link: [php.net...] ;-)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved