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 9ea8e54b01be8d70695225e4b88834f0a6a9820f..cb7463b62a945c653b88feaee0a58636682d31d3 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) == '&') {