diff --git a/src/SmartEmailing.php b/src/SmartEmailing.php index ac95be5..add7a90 100644 --- a/src/SmartEmailing.php +++ b/src/SmartEmailing.php @@ -293,10 +293,10 @@ protected function callSmartemailingApiWithCurl($data) { return $this->getErrorXml($e->getCode(), $e->getMessage()); } + $xml = simplexml_load_string($response); - if ($this->isValidXmlString($response)) { - return new \SimpleXMLElement($response); - + if ($xml !== FALSE) { + return $xml; } else { return $this->getErrorXml('500', 'Unknown Smartemailing API error.'); } @@ -319,25 +319,4 @@ public function getErrorXml($code, $message) { return $xml; } - - /** - * check if xml string is valid - * - * @param string $xmlString - * @return bool - */ - protected function isValidXmlString($xmlString) { - libxml_use_internal_errors(TRUE); - - $doc = simplexml_load_string($xmlString); - - if (!$doc) { - $errors = libxml_get_errors(); - - return empty($errors); - } - - return FALSE; - } - }