Handling of unexpected errors from API rewritten
authorRoland Häder <roland@mxchange.org>
Fri, 14 Aug 2009 20:09:29 +0000 (20:09 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 14 Aug 2009 20:09:29 +0000 (20:09 +0000)
inc/libs/wernis_functions.php

index 56302d5..b9418aa 100644 (file)
@@ -113,7 +113,13 @@ function WERNIS_SEND_REQUEST ($scriptName, $requestData =  array()) {
        } // END - if
 
        // All (maybe) fine so remove the response header from server
-       $response = $response[(count($response) - 1)];
+       for ($idx = (count($response) - 1); $idx > 1; $idx--) {
+               $line = $response[$idx];
+               if (!empty($line)) {
+                       $response = $line;
+                       break;
+               }
+       }
 
        // Prepare the returning result for higher functions
        if (substr($response, 0, 1) == '&') {