title: How do I handle Warning: SimpleXMLElement::__construct()?
body: <p>I'm getting this error when I run in local host, if internet is disconnected (if internet is connect its ok) I want to handle this error, "error can show " but want to handle not fatal error break on PHP page.</p>
  
  <pre><code>Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]:
    php_network_getaddresses: getaddrinfo failed: No such host is known.
    in F:\xampp\htdocs\shoptpoint\sections\docType_head_index.php on line 30
  </code></pre>
  
  <p>but I'm trying to handle using try-catch. Below is my code</p>
  
  <pre><code>$apiurl="http://publisher.usb.api.shopping.com/publisher/3.0/rest/GeneralSearch?apiKey=78b0db8a-0ee1-4939-a2f9-d3cd95ec0fcc&amp;trackingId=7000610&amp;categoryId='5855855'";
  
  try{
    new SimpleXMLElement($apiurl,null, true);
  }catch(Exception $e){
    echo $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>How do I handle the error and my page can execute end of the project?</p>