Use is_xml instead of simplexml_load_string
Reason for the change is it was throwing and error. Also using regex is less resource intensive. Using this to determine the content type.
This commit is contained in:
parent
4d54821119
commit
ad34744272
|
|
@ -465,15 +465,14 @@
|
|||
header("Content-Length: ".strlen($file_contents));
|
||||
}
|
||||
else {
|
||||
$result = simplexml_load_string ($file_contents, 'SimpleXmlElement', LIBXML_NOERROR+LIBXML_ERR_FATAL+LIBXML_ERR_NONE);
|
||||
if (false == $result) {
|
||||
header("Content-Type: text/plain");
|
||||
header("Content-Length: ".strval(strlen($file_contents)));
|
||||
}
|
||||
else {
|
||||
if (is_xml($file_contents)) {
|
||||
header("Content-Type: text/xml; charset=utf-8");
|
||||
header("Content-Length: ".strlen($file_contents));
|
||||
}
|
||||
else {
|
||||
header("Content-Type: text/plain");
|
||||
header("Content-Length: ".strval(strlen($file_contents)));
|
||||
}
|
||||
}
|
||||
}
|
||||
echo $file_contents;
|
||||
|
|
|
|||
Loading…
Reference in New Issue