add checkFirmware
authorStricted <info@stricted.de>
Sun, 28 Jun 2015 07:18:37 +0000 (09:18 +0200)
committerStricted <info@stricted.de>
Sun, 28 Jun 2015 07:18:37 +0000 (09:18 +0200)
speedport.class.php
tests/checkfirmware.php [new file with mode: 0644]

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);
                $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');
                }
                if (empty($data['body'])) {
                        throw new Exception('unable to get syslog data');
                }
@@ -255,6 +255,26 @@ class speedport {
                return explode("\n", $data['body']);
        }
        
                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
         * 
        /**
         * sends the request to router
         * 
diff --git a/tests/checkfirmware.php b/tests/checkfirmware.php
new file mode 100644 (file)
index 0000000..defa44b
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+require_once('config.php');
+print_r($sp->checkFirmware());
+$sp->logout();