-
☆ A M B ☆
- 1,231 Posts
As the title says...
How can I check if an XML exists? I am using an external XML feed that I’m allowed to use but it goes down now and again for maintenance which causes a parse error on my page. When the XML feed is down, there is a redirect to an HTML page saying it’s down for maintenance if this is of help.
How can I check if the XML feed is available before attempting to take values?
Thanks!
-
☆ A M B ☆
- 1,231 Posts
Thanks mr... I had a quick scan over that and didn’t make much sense to me but I’ll look again later.
do you want to receive a notification that the XML file is missing (in case when it is) instead of having a message about error? I would like to have this possibility if it’s possible.
-
☆ A M B ☆
- 1,231 Posts
If the XML is unavailable there is not an error. You are simply redirected to an HTML page saying that XML service is down. That’s why I need someway to tell if the xml exists.
Something like this
...
catch (Exception $e) {
//some error occured, we send the user to error page
$modx->sendRedirect('http://www.domain.com/xml-error.html');
}
...