Posted by sunnyboyGuo on 01/09/08 10:00
Deal all,
When I use DOMDocument::load function to load one xml file, if this
file is not found, I want to give the 500 status to my client program
(not internet explorer).
But the load function will give some warning message and then I can
not rewrite the header because headers already sent.
How can I catch this exception and use header function to write header
information?
The code is as follows:
$DOC = new DOMDocument();
if ($DOC->load($some_file))
{
do something.
} else {
Header("http/1.1 500 Internal Server Error");
return;
}
thank you very much.
Best wishes,
Tony
[Back to original message]
|