This question has already been answered:
- Error 404 in the response cURL 1 answer
With cURLa poking on the XML page. If this page does not exist, then it redirects to a beautifully designed 404 page. As a result, SimpleXML gives an error that the XML is invalid. Question: how to determine that cURL received a 404 page, and not an XML file? Or maybe there is some other way ..?
I attach the code:
$ch = curl_init($xml_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $xml_page = curl_exec($ch); curl_close($ch); Thank.