I'm coding a little script that retrieves information stored on an xml on a remote server. The trouble is when I load the XML in this way:
Code:
$xml = new SimpleXMLElement("http://www.xxx.com/address/of/xml.xml", NULL, TRUE );
Well I happen to have the following error because of too many connected at the same time:
Warning: SimpleXMLElement::__construct(
http://www.xxx.com/address/of/xml.xml) [simplexmlelement.--construct]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\Program Files\EasyPHP5.3.0\www\project\resources\xml.php on line 43
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: I/O warning : failed to load external entity "http://www.xxx.com/address/of/xml.xml" in C:\Program Files\EasyPHP5.3.0\www\project\resources\xml.php on line 43
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in C:\Program Files\EasyPHP5.3.0\www\project\resources\xml.php:43 Stack trace: #0 C:\Program Files\EasyPHP5.3.0\www\project\resources\xmlr.php(43): SimpleXMLElement->__construct('http://www.xxx.com/address/of/xml.xml', 0, true) #1 {main} thrown in C:\Program Files\EasyPHP5.3.0\www\project\resources\xml.php on line 43
How can I ensure that the XML will be reloaded until there is no error and continue the execution of my script?
Bookmarks