/** * @param $url * @param string $data * @param array $headers * @return bool|array|mixed|\SimpleXMLElement */ protected function processCurl($url, $data = "", $headers = []) { $success = false; $errors = []; $result = parent::processCurl($url, $data, $headers); if ($result) { $resultObj = simplexml_load_string($result); if ($resultObj->fault) { foreach ($resultObj->fault as $error) { $errors[] = (string) $error['string']; } } else { $success = true; } } return ['success' => $success, 'errors' => $errors, 'data' => $result, 'obj' => $resultObj ? $resultObj : false]; }
/** * @param $url * @param string $data * @param array $headers * @return bool|array|mixed|\SimpleXMLElement */ protected function processCurl($url, $data = "", $headers = []) { $success = false; $errors = []; $result = parent::processCurl($url, $data, $headers); if ($result) { $resultObj = simplexml_load_string($result); if ($resultObj->Error) { foreach ($resultObj->Error as $error) { $errors[] = (string) $error; } } elseif ($this->returnWarnings && $resultObj->Success && $resultObj->Success->Warning) { foreach ($resultObj->Success->Warning as $warning) { $errors[] = 'Warning: ' . (string) $warning; } } else { $success = true; } } return ['success' => $success, 'errors' => $errors, 'data' => $result, 'obj' => $resultObj ? $resultObj : false]; }