PHP simplexml_load_file - error handling
<p>I'm loading a XML file from a foreign server which is working. But how do I receive an error message if the file does not exist or something else went wrong while loading it? </p>

<p>This is my code:</p>

<pre><code>$xml = simplexml_load_file('http://api.example.com/2/image/' . $myhash . '.xml'); 
</code></pre>

<p>Also I'ld like to know what's the best practice if something like that happens. 
Should I just display an error message like "error - please reload page" or should I directly redirect the user like to the "homepage" or a 404 page?</p>

<p>Thanks for tips. 
(I've only found examples for files on the same server)</p>
