detecmedia/fritzbox-connector

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
There is no license information available for the latest version (dev-master) of this package.

Installs: 11

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Language:HTML

Type:project

dev-master 2019-05-01 12:55 UTC

This package is not auto-updated.

Last update: 2021-10-15 11:04:12 UTC


README

Connect with Fritzbox FRITZ!OS:06.50

<?php
require 'bootstrap.php';
require 'vendor/autoload.php';
require 'src/Detecmedia/FritzboxConnector/Pages.php';

use Detecmedia\FritzboxConnector\Pages;
use Detecmedia\FritzboxConnector\Connector\FritzboxConnector;
use GuzzleHttp\Client;

$pages = new Pages();

$clientMock = new Client(['base_uri' => $fritzboxUrl]);
$connector = new FritzboxConnector($clientMock, $pages, ['debug' => true]);

if (!$connector->connect()) {
    throw new \RuntimeException('not connecting with box');
}
if (!$connector->login($fritzboxUser, $fritzboxPassword)) {
    throw new \RuntimeException('not logged in in box');
}

$overview = new Overview($pages);
$response = $connector->send($overview, Pages::DEFAULT);

$jsonArray = json_decode($response->getBody()->getContents(), true);
echo $jsonArray['data']['fritzos']['boxDate'];
$connector->logout();