diff --git a/common/HttpClient.php b/common/HttpClient.php index 15043fc..2e363ae 100644 --- a/common/HttpClient.php +++ b/common/HttpClient.php @@ -528,6 +528,9 @@ class HttpClient return $body; } $type = $data['content-type']; + if ($this->isXml($body)) { + return Help::toArray($body); + } if (strpos($type, 'text/html') !== false) { return $body; } else if (strpos($type, 'json') !== false) { @@ -540,6 +543,11 @@ class HttpClient return $body; } + private function isXml($body) + { + return preg_match('/^<[a-zA-Z_]+>(.*?)?<\/[a-zA-Z_]+>$/', $body); + } + /** * @param $headers * @return array