/s', '', substr($xml, 0, 100), 1); if (($xml = trim(substr_replace($xml, $header, 0, 100))) === '') { return false; } // Check if there is no content after the DTD. $header = preg_replace('/^]*+>/i', '', substr($xml, 0, 200), 1); if (($xml = trim(substr_replace($xml, $header, 0, 200))) === '') { return false; } // Check that the root tag is valid. if (!preg_match('/^<(methodCall|methodResponse|fault)/', $xml)) { return false; } return true; } }