From 4ae464d153f5f08a023f1421babf7cd7fd683916 Mon Sep 17 00:00:00 2001 From: Stricted Date: Sun, 28 Jun 2015 09:18:37 +0200 Subject: [PATCH] add checkFirmware --- speedport.class.php | 22 +++++++++++++++++++++- tests/checkfirmware.php | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/checkfirmware.php diff --git a/speedport.class.php b/speedport.class.php index 692b7c3..90f5c32 100644 --- a/speedport.class.php +++ b/speedport.class.php @@ -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 * diff --git a/tests/checkfirmware.php b/tests/checkfirmware.php new file mode 100644 index 0000000..defa44b --- /dev/null +++ b/tests/checkfirmware.php @@ -0,0 +1,4 @@ +checkFirmware()); +$sp->logout(); -- 2.20.1