add checkFirmware
[GitHub/Stricted/speedport-hybrid-php-api.git] / speedport.class.php
index 692b7c31647a148f0489ddf6ea6ea3cb9fdfa17e..90f5c32154dc8658d5337baf6a07d1443d6d987f 100644 (file)
@@ -247,7 +247,7 @@ class speedport {
                $fields = array('exporttype' => '3');
                $cookie = 'challengev='.$this->challenge.'; '.$this->session;
                $data = $this->sentRequest($path, $fields, $cookie);
-               
+               print_r($data);
                if (empty($data['body'])) {
                        throw new Exception('unable to get syslog data');
                }
@@ -255,6 +255,26 @@ class speedport {
                return explode("\n", $data['body']);
        }
        
+       /**
+        * check if firmware is actual
+        * 
+        * @return      array
+        */
+       public function checkFirmware () {
+               $path = 'data/checkfirmware.json';
+               $fields = array('checkfirmware' => 'true');
+               $cookie = 'challengev='.$this->challenge.'; '.$this->session;
+               $data = $this->sentRequest($path, $fields, $cookie);
+               
+               if (empty($data['body'])) {
+                       throw new Exception('unable to get checkfirmware data');
+               }
+               
+               $json = json_decode($data['body'], true);
+               
+               return $json;
+       }
+       
        /**
         * sends the request to router
         *