I need to loop through thousands urls, each url is for parsing one record in xml, in each run I will parse one record, i am using simplexml.
But sometimes, due to server connection issue, in certain run, the simplexml will throw a fatal error, like Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML'.
Actually the string is fine if I run it next time. Due to I query that web services thousands times in a short time, server connection error may cause this problem.
When this happens, due to it is fatal error, the full loop terminated. Meaning I want to parse the 1000 records, i may stop at 500th record or so. I will miss another 500 records.
What I want to do is, if there is a simplexml consturct error, don't throw fatal error, skip it, loop to the next run. So then in 1000 records, I may miss one or two record, that is acceptable.
So how can I skip the fatal error and continue the loop?