I’m retrieving XML data using cURL, but it is being truncated due to CURLOPT_TIMEOUT (which is necessary for other reasons). Is there any way to correct/discard portions of/recover in some way this data so it can be read by SimpleXmlElement?
When the file is allowed to be received in full it is parsed perfectly, I need a way to still get the object when the transfer is cut off.
Afaik there is no such tool as an “incomplete XML parser”. If you need to extract data from such a file, you’ll probably have to do it manually by using either string functions or regular expressions.
With that said, you may want to change your XML documents so they fit into the timeframe. Compression (gzip) or splitting into multiple documents could be an option.