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 56302d59e66111f31ec5a272116ca2c2fa10f152..b9418aa9d5cf2e3e3b0f7cc86faf18a38d8517a0 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) == '&') {