- } elseif ((is_array($response[0])) && (isset($response[0]['id']))) {
- // Begin with extraction
- $codeArray = explode(' ', $response[0]['id']);
- $code = $codeArray[0];
- $codeArray = explode('<br />', $code);
- $code = $codeArray[0];
- $codeArray = explode('<br>', $code);
- $code = $codeArray[0];
-
- // Remove all new-line characters
- $codeArray = explode("\n", $code);
- $code = $codeArray[0];
-
- // Remove carrige-return
- $code = str_replace("\n", '', $code);
-
- } elseif (count($response) < 9) {
+ } elseif (!empty($response[0])) {
+ // Merge response together
+ $parts = explode('|', implode('', $response));
+
+ // If we have only one part, we got an error
+ if (count($parts) > 1) {
+ // All fine
+ $code = '0';
+ } else {
+ // Begin with extraction of error code
+ $codeArray = explode(' ', $response[0]);
+ $code = $codeArray[0];
+ $codeArray = explode('<br />', $code);
+ $code = $codeArray[0];
+ $codeArray = explode('<br>', $code);
+ $code = $codeArray[0];
+
+ // Remove all new-line characters
+ $codeArray = explode("\n", $code);
+ $code = $codeArray[0];
+
+ // Remove carrige-return
+ $code = trim(str_replace("\n", '', $code));
+
+ // Is it still empty?
+ if (empty($code)) {
+ // Then fix it
+ $code = -999;
+ } // END - if
+ }
+ } elseif (count($response) == 0) {
+ // All fine, but empty result
+ $code = '0';
+ } else {