w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
I am reading RSS link if it is not valid then throwing exception,How to hadle it using PHP

DOMDocument::load() returns false on failure, so you could do something like:

if ($xmlDoc->load($xml)) {
    // work with the XML
} else {
    // display an error message

This won't prevent the warnings from being raised, but it does allow you to handle the problem. Having the warnings could be useful to you, so you can see in your logs how often a resource you're depending on is failing.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.