Wernis API updated to handle unexpected error messages from API
authorRoland Häder <roland@mxchange.org>
Fri, 14 Aug 2009 20:14:58 +0000 (20:14 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 14 Aug 2009 20:14:58 +0000 (20:14 +0000)
inc/classes/third_party/api/wernisportal/class_WernisApi.php

index 9ea8e54..cb7463b 100644 (file)
@@ -218,7 +218,13 @@ class WernisApi extends BaseFrameworkSystem {
                }
 
                // All (maybe) fine so remove the response header from server
-               $response = $response[(count($response) - 1)];
+               for ($idx = (count($response) - 1); $idx > 1; $idx--) {
+                       $line = trim($response[$idx]);
+                       if (!empty($line)) {
+                               $response = $line;
+                               break;
+                       }
+               }
 
                // Prepare the returning result for higher functions
                if (substr($response, 0, 1) == '&') {