I have found these errors in my error log:
[05-Aug-2009 12:57:27] PHP Warning: SimpleXMLElement::__construct() [<a href='simplexmlelement.--construct'>simplexmlelement.--construct</a>]: ^ in /home/mojo/public_html/shackupload.php on line 37
The funny thing is I had about 200 of the above in my error log all with the same timestamp! What is going on and why so many?!
The lines in question is this:
if(!(substr($res, 0, 6)=='Failed')){
$xml = new SimpleXMLElement($res) or die('Error creating a SimpleXML instance');
$imagelink = (string) $xml->image_link; // This is the image link
$_SESSION['shack_link'] = $imagelink;
echo 'done';
}
The documentation of SimpleXMLElement::__construct says (quoting) :
So, I’d say you tried to load a file that contains XML errors (a non-valid file, for instance).
And to explain the fact you got 200 errors at the same time : you must have something like 200 errors in your file, as
__constructgenerates oneE_WARNINGper error in the XML data.Logging the XML data to a file, in such situation, might help you finding precisely what caused the warnings… At least if that doesn’t happen often.
EDIT : BTW, looking at your error_log once in a while is really a good idea ! I don’t see enough people doing that 🙁