From: Stricted Date: Sun, 28 Jun 2015 07:18:37 +0000 (+0200) Subject: add checkFirmware X-Git-Tag: 1.0.0~15 X-Git-Url: https://git.stricted.de/?p=GitHub%2FStricted%2Fspeedport-hybrid-php-api.git;a=commitdiff_plain;h=4ae464d153f5f08a023f1421babf7cd7fd683916 add checkFirmware --- 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();