Fritz!Box API für PHP (inkl. Login-Sessions)

Wenn du das weisst, warum schreibst du dann...
:doktor:
1122tra schrieb:
Die letzte Zeile des Skripts ist die essentielle für den Reboot, lässt sich also auch mit einem einfachen GET-Request in PHP machen.
:confused:
...weil: Das stimmt so nicht


Außerdem reicht ein simpler Anruf z.B. mit einem DECT um die Box zu booten.
...find ich viel einfacher.

Wobei ich mir wünschen würde diese Möglichkeit deaktivieren zu können.
...denn genauso können auch die Werkseinstellungen geladen werden.

Oder hat AVM, wie die Möglichkeit den telnetd zu Aktivieren, dass mittlerweile ausgebaut?
 
Zuletzt bearbeitet:
:doktor::confused:
...weil: Das stimmt so nicht

Doch weil sie nirgends im Web so zu finden ist => URL-Parameter extern_reboot=1! Und ich habe den Link hier gespostet weil es solch eine Lösung noch nicht gibt.
Lese den Post doch mal ganz. Und versuche im Web eine Lösung dieser Art für die aktuellen OS 6.x zu finden !

Außerdem reicht ein simpler Anruf z.B. mit einem DECT um die Box zu booten.
...find ich viel einfacher.

Schon klar, aber für ein Script ungeeignet ... und darum geht es ja hier (Titel: Fritz!Box API für PHP (inkl. Login-Sessions)).
Jeder hat andere Voraussetzungen und Bedingungen die er berücksichtigen muss. Manuell geht ja immer ...

Oder hat AVM, wie die Möglichkeit den telnetd zu Aktivieren, dass mittlerweile ausgebaut?

In der aktuellen Labor-Version ist der Telnet Dienst bereits entfernt worden, ist also nur noch eine Frage der Zeit bis dies in den regulären Firmware-Versionen Einzug findet!
In dieser Hinsicht ist das Script also für die Zukunft sehr nützlich, wenn es keine Möglichkeit per Telnet mehr gibt und man seine Box per Script rebooten möchte.
Natürlich hat man immer die Möglichkeit seine Box zu freetzen, aber nicht jeder hat dazu, aus verschiedensten Gründen die Möglichkeit.

Das ist alles. Mehr Diskussion braucht's da eigentlich nicht mehr.

Gruß
 
Zuletzt bearbeitet:
Mehr Diskussion braucht's da eigentlich nicht mehr.
Das muß/soll mich hoffentlich nicht von der Feststellung abhalten, daß der in der verlinkten Seite eingeschlagene Weg über die Analyse des Lua-Codes in diesem Falle trotzdem (weitgehend) unnötig ist, denn für diesen Zweck gibt es tatsächlich eine dokumentierte Schnittstelle von AVM und (solange AVM diese nicht ändert, was bei dokumentierten Schnittstellen deutlich seltener passiert als bei undokumentierten) das sollte dann auch der präferierte Weg sein.

Wenn man ohnehin mehrere Requests ausführen muß anstatt "nur" eine URL aufzurufen (die Notwendigkeit des Logins über mehrere Requests bleibt ja bestehen), dann kann man auch gleich einen korrekten SOAP-Request erzeugen, ggf. funktioniert das dann sogar wieder mit einem einzelnen Aufruf und "pre-auth" per Basic-Auth für den (dann besser TLS-geschützten) Request.

Nichts gegen "funktionierende" Lösungen, aber wenn es für denselben Zweck dokumentierte Funktionen gibt, sollte man lieber diese nutzen ... die bösen Überraschungen beim nächsten Update werden dadurch deutlich seltener auftreten (gilt auch für die "webcm-Nutzer" bei aktueller Firmware, wenn die jetzt ihre Lösungen umstellen).
 
Moins

Ja genau, TR-064.

Reboot - OK, geht ja noch.
FactoryReset? - Ohne Login? Wie beim Telefon?
 
FactoryReset? - Ohne Login?
Nicht ohne Anmeldung ... aber anders als im GUI ist das - an einigen Stellen zumindest - ohne Challenge/Response (eben pre-auth) möglich und dafür braucht's dann als die TLS-Verschlüsselung, damit da die Credentials nicht im Klartext durch's LAN gehen.
 
fritzbox_tam_on_off_lua.php
PHP:
<?php
/**
 * Fritz!Box PHP tools CLI script to enable or disable answering machines
 *
 * Must be called via a command line, shows a help message if called without any or an invalid argument
 * Can log to the console or a logfile or be silent
 * new in v0.2: Can handle remote config mode via https://example.dyndns.org
 * new in v0.3: Refactored code to match API version 0.5
 *
 * Check the config file fritzbox.conf.php!
 *
 * @author   Gregor Nathanael Meyer <Gregor [at] der-meyer.de>
 * @license  http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons cc-by-sa
 * @version  0.4 2013-01-02
 * @package  Fritz!Box PHP tools
 *
 * Geändert: 19.01.2015 mit query.lua ab Firmware xxx.04.88
 * Geändert: 27.06.2015 mit lua ab Firmware xxx.06.25
 */

try
{
  // load the fritzbox_api class
  require_once('fritzbox_api.class.php');
  $fritz = new fritzbox_api();

  // init the output message
  $message = date('Y-m-d H:i') . ' ';

  // handle the CLI arguments or give a help message
  if (isset($argv[1]) && ($argv[1] == 0 || $argv[1] == 1 || $argv[1] == 2) )
  {
    $mode = (int)$argv[1];
  }
  else
  {
    if ( $fritz->config->getItem('logging') == 'console' )
    {
      echo '
  Enables or disables an answering machine (TAM) of a Fritz!Box

  Usage on UNIX systems:
    /path/to/php ' .  $argv[0] . ' {0|1} [optional: TAM]

  Usage on Windows systems:
    c:\path\to\php.exe ' .  $argv[0] . ' {0|1} [optional: TAM]

  0 disable the TAM
  1 enable the TAM

  The optional argument TAM and addresses the nth answering machine
  Defaults to 0, which is the TAM **600; 1 is the TAM **601 and so on
  
  Warning: A non existent TAM will not lead to an error message but adds a
  new TAM to the Fritz!Box, which will answer all incoming calls by default!
      ';
    }
    else
    {
      $fritz->logMessage($message . 'ERROR: Script was called without or with an invalid argument');
    }
    exit;
  }
  $tam = (isset($argv[2]) && $argv[2] >= 0 && $argv[2] <= 9) ? (int)$argv[2] : 0;

  // TAM Status mode = 0|1|2
  if ($mode == 0 || $mode == 1 || $mode == 2)
  {
    $formfields = array(
      'getpage' => '/query.lua',
      'tam_'.$tam.'_Active' => 'tam:settings/TAM'.$tam.'/Active',
      'tam_'.$tam.'_Name' => 'tam:settings/TAM'.$tam.'/Name',
      'tam_'.$tam.'_NumNewMessages' => 'tam:settings/TAM'.$tam.'/NumNewMessages',
      'tam_'.$tam.'_NumOldMessages' => 'tam:settings/TAM'.$tam.'/NumOldMessages'
    );

    $output = $fritz->doGetRequest($formfields);

    $output_o = json_decode($output);

    // TAM Status mode = 2
    if ($mode == 2)
    {
      $message .= "TAM".$tam." Active: ".$output_o->{'tam_'.$tam.'_Active'}." |".
          " Name: ".$output_o->{'tam_'.$tam.'_Name'}." |".
          " NumNewMessages: ".$output_o->{'tam_'.$tam.'_NumNewMessages'}." |".
          " NumOldMessages: ".$output_o->{'tam_'.$tam.'_NumOldMessages'};
    }
  }

  if ($mode == 0 || $mode == 1)
  {

    // update the setting
    if ($output_o->{'tam_'.$tam.'_Active'} != $mode)
    {

      $formfields = array(
        'getpage' => '/fon_devices/tam_list.lua',
        'useajax' => '1',
        'TamNr' => $tam,
        'switch' => 'toggle'
      );

      $dummy = $fritz->doGetRequest($formfields);

    }

    // check if the update succeded
    $formfields = array(
      'getpage' => '/query.lua',
      'tam_'.$tam => 'tam:settings/TAM'.$tam.'/Active'
    );

    $output = $fritz->doGetRequest($formfields);
  
    preg_match('@"tam_' . $tam . '": "([10])"@i', $output, $matches);

    if (isset($matches[1]) && $matches[1] == $mode)
    {
      $message .= $mode == 1 ? 'TAM' . $tam . ' enabled' : 'TAM' . $tam . ' disabled';
    }
    else if (isset($matches[1]))
    {
      $message .= 'ERROR: TAM' . $tam . ' status change failed, should be ' . $mode . ', but is ' . $matches[1];
    }
    else
    {
      $message .= 'NOTICE: TAM' . $tam . ' status change could have failed, should be ' . $mode . ' now, but I don\'t now if it actually is. Check your check section in the script.';
    }
  } // mode = 0|1
}
catch (Exception $e)
{
  $message .= $e->getMessage();
}

// log the result
if ( isset($fritz) && is_object($fritz) && get_class($fritz) == 'fritzbox_api' )
{
  $fritz->logMessage($message);
}
else
{
  echo($message);
}

$fritz = null; // destroy the object to log out

?>

fritzbox_tam_on_off_lua.php 0 off
fritzbox_tam_on_off_lua.php 1 on

Status mit fritzbox_tam_on_off_lua.php 2 wenn's OK ist mit der Anzeige
ansonsten kannst du es ja Anpassen.
 
Hallo zusammen,

ich bräuchte mal eure Hilfe.

Ich versuche unter Ubuntu 14.04 und dem dem Api Skript in der Version 0.5.0b7 auf eine KabelBW FB 6340 mit OS 6.04 zuzugreifen um das GuestWLAN zu aktivieren. Leider scheitere ich (wie ich das erkenne) schon an der Anmeldung an der Fritzbox.

Kann mir generell mal jemand erklären was die "remote config" Zugangsdaten (remote_config_user u. remote_config_password) im Unterschied zu den ConfigItems (username/password) bedeuten. Wenn ich per Browser auf meine FB im lokalen Netzwerk zugreife, werde ich nur nach meinem Passwort gefragt, aber nach keinem User. Welche Zugangsdaten muss ich also wählen bzw. was muss ich in der conf eingeben?

Aktuell bekomme ich in allen Varianten die ich mit Username/Passwort probiert habe immer die Fehlermeldung:
Response of initialization call /login_sid.lua in initSID was not xml-formatted

Ein
Code:
var_dump($this->doGetRequest(array('getpage' => $loginpage)));
in der api.class.php liefert mir nur:
Code:
bool(false)

Kann mir jemand weiterhelfen?
 
Ok, ich habe meine FB mal auf "Anmeldung mit Benutzer/Passwort" umgestellt. Leider bekomme ich aber trotzdem immer noch die genannte Fehlermeldung.
 
Moins

Wichtig sind und bleiben die richtigen Eintragungen in der API Konfiguration.
Solange nicht klar ist was bei dir drinnesteht, kann auch nur darauf verwiesen
werden. Also lies mal: KlickKlack
 
meine fritzbox_user.conf.php sieht wie folgt aus

Code:
<?php
if ( !isset($this->config) )
{
  die(__FILE__ . ' must not be called directly');
}

####################### central API config ########################
# notice: you only have to set values differing from the defaults #
###################################################################

# use the new .lua login method in current (end 2012) labor and newer firmwares (Fritz!OS 5.50 and up)
$this->config->setItem('use_lua_login_method', true);

# set to your Fritz!Box IP address or DNS name (defaults to fritz.box), for remote config mode, use the dyndns-name like example.dyndns.org
$this->config->setItem('fritzbox_ip', 'meineIP');

# if needed, enable remote config here
#$this->config->setItem('enable_remote_config', true);
#$this->config->setItem('remote_config_user', 'meinUser');
#$this->config->setItem('remote_config_password', 'meinPasswort');

# set to your Fritz!Box username, if login with username is enabled (will be ignored, when remote config is enabled)
$this->config->setItem('username', 'meinUser');

# set to your Fritz!Box password (defaults to no password, will be ignored, when remote config is enabled)
$this->config->setItem('password', 'meinPasswort');

# set the logging mechanism (defaults to console logging)
$this->config->setItem('logging', 'console'); // output to the console
#$this->config->setItem('logging', 'silent');  // do not output anything, be careful with this logging mode
#$this->config->setItem('logging', 'tam.log'); // the path to a writeable logfile

# the newline character for the logfile (does not need to be changed in most cases)
$this->config->setItem('newline', (PHP_OS == 'WINNT') ? "\r\n" : "\n");


############## module specific config ###############

# set the path for the call list for the foncalls module
$this->config->setItem('foncallslist_path', __DIR__ . '\foncallsdaten.csv');
 
So

Wie greifst du zu?

Aus dem lokalen Netz oder von Internetseite?

Lokal...
PHP:
# set to your Fritz!Box IP address or DNS name (defaults to fritz.box), for remote config mode, use the dyndns-name like example.dyndns.org
$this->config->setItem('fritzbox_ip', 'fritz.box');
# set to your Fritz!Box username, if login with username is enabled (will be ignored, when remote config is enabled)
$this->config->setItem('username', 'meinUser');
# set to your Fritz!Box password (defaults to no password, will be ignored, when remote config is enabled)
$this->config->setItem('password', 'meinPasswort');

Remote...
PHP:
# set to your Fritz!Box IP address or DNS name (defaults to fritz.box), for remote config mode, use the dyndns-name like example.dyndns.org
$this->config->setItem('fritzbox_ip', 'meinhostname.spdns.org');
# if needed, enable remote config here
$this->config->setItem('enable_remote_config', true);
$this->config->setItem('remote_config_user', 'meinUser');
$this->config->setItem('remote_config_password', 'meinPasswort');
 
Ich greife lokal zu. Frag mich nicht wieso, aber jetzt funktioniert es. Reboot tut immer gut :)

Ich kann das GästeWLAN nun ein- und ausschalten. Allerdings wird das GästeWLAN immer unverschlüsselt aktiviert. Auch wenn ich zusätzlich noch das Passwort als Parameter übergebe.

Wie kann ich das GästeWLAN aktivieren inkl. Verschlüsselung?
 
Oh, ich glaub da muss Pikachu ran.
Das ging mal (Keine Ahnung bis zur welchen F!B Version).
Jetzt müssen die Parameter wohl immer explizit mit angegeben/angeschaltet werden.

Versuch mal bis dahin:

1. Einmal im Webinterface so einrichten und anschalten wie du es brauchst
2. Erst danach mit der API aus/einschalten

Ist es dann Besser?
 
Nein, habe ich auch schon versucht.

Sobald ich das WLAN per API einschalte, wird die Verschlüsselung auf "unverschlüsselt" umgestellt. Der Parameter "Passwort" hat keine Auswirkung. In der FB bleibt zwar das über das Webinterface eingestellte Pwd erhalten und wird auch in der Message zurückgegeben. Da aber die Verschlüsselung umgestellt wird, greift das Pwd ja nicht mehr.
 
Das Abschalten der Verschlüsselung ist wenig verwunderlich, wenn in dem Request der gewünschte Modus nicht angegeben ist.

Die /usr/www/avm/wlan/guest_access.lua sieht an der relevanten Stelle jedenfalls so aus:
Code:
if box.post.sec_mode and box.post.sec_mode ~= "5" then
    if box.post.wpa_key and box.post.wpa_key ~= "" then
        cmtable.add_var(ctlmgr_save, "wlan:settings/guest_pskvalue" , box.post.wpa_key)
    end
    cmtable.add_var(ctlmgr_save, "wlan:settings/guest_encryption" , box.post.sec_mode)
else
    cmtable.add_var(ctlmgr_save, "wlan:settings/guest_encryption" , "0")
end
(Einrückungen nicht im Original)

Wenn also im Request der richtige "sec_mode"-Parameter (vermutlich 3) angegeben wird, dann ist es vollkommen egal, ob da ein Kennwort (neu) vergeben wird, denn wenn dieses fehlt, bleibt das alte in Kraft.

Fehlt aber schon der "sec_mode"-Parameter, wird eben "0" für die Verschlüsselung gesetzt.

Einfach den Request entsprechend anpassen und es sollte wieder funktionieren.
 
Oh, ich glaub da muss Pikachu ran.

Ne Sorry da muss der Entwickler @spackmat selbst ran, denn das hier ist ja nicht von mir.

Aber du kannst ja das mal Testen hier: fritzbox_guestwlan_on_off.php
PHP:
<?php
/**
 * Fritz!Box PHP tools CLI script to enable or disable the WLAN guest access
 *
 * Must be called via a command line, shows a help message if called without any or an invalid argument
 *
 * Check the config file fritzbox.conf.php!
 *
 * @author   Gregor Nathanael Meyer <Gregor [at] der-meyer.de>
 * @license  http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons cc-by-sa
 * @version  0.3 2013-01-02
 * @package  Fritz!Box PHP tools
 * Geaendert 01.07.2015 "sec_mode" hinzugefuegt
 */

try
{
  // load the fritzbox_api class
  require_once('fritzbox_api.class.php');
  $fritz = new fritzbox_api();

  // init the output message
  $message = date('Y-m-d H:i') . ' ';

  // handle the CLI arguments or give a help message
  if (isset($argv[1]) && ($argv[1] == 0 || $argv[1] == 1) )
  {
    $mode = (bool)$argv[1];
  }
  else
  {
    if ( $fritz->config->getItem('logging') == 'console' )
    {
      echo '
  Enables or disables the WLAN guest access of a Fritz!Box

  Usage on UNIX systems:
    /path/to/php ' .  $argv[0] . ' {0|1} [optional: PASSWORD]

  Usage on Windows systems:
    c:\path\to\php.exe ' .  $argv[0] . ' {0|1} [optional: PASSWORD]

  0 disables the guest access
  1 enables the guest access

  The optional argument PASSWORD sets a new guest access password (min 8 chars)
  Defaults to false, so the current password is kept.
  ';
    }
    else
    {
      $fritz->logMessage($message . 'ERROR: Script was called without or with an invalid argument');
    }
    exit;
  }
  $wpa_key = (isset($argv[2]) && strlen($argv[2]) >= 8 && strlen($argv[2]) <= 63) ? $argv[2] : false;


  // read the current settings
  $formfields = array(
    'getpage' => '/wlan/guest_access.lua',
  );
  $output = $fritz->doGetRequest($formfields);

  // read down_time_activ setting
  preg_match('@name="down_time_activ"[^>]+(checked)[^>]*@', $output, $matches);
  if ( isset($matches[1]) )
  {
    $formfields['down_time_activ'] = 'on';
  }
  // read down_time_value setting
  preg_match('@name="down_time_value".*?<option value="(\d+)"[^>]+?selected.*?</select>@s', $output, $matches);
  $formfields['down_time_value'] = isset($matches[1]) ? $matches[1] : '15';
  // read disconnect_guest_access setting
  preg_match('@name="disconnect_guest_access"[^>]+(checked)[^>]*@', $output, $matches);
  if ( isset($matches[1]) )
  {
    $formfields['disconnect_guest_access'] = 'on';
  }
  // read guest_ssid setting
  preg_match('@name="guest_ssid"[^>]+value="([^"]*)"[^>]*@', $output, $matches);
  $formfields['guest_ssid'] = isset($matches[1]) ? $matches[1] : 'defaultguestaccess';
  // read wlan_security setting
  preg_match('@name="sec_mode".*?<option value="(\d+)"[^>]+?selected.*?</select>@s', $output, $matches);
  $formfields['sec_mode'] = isset($matches[1]) ? $matches[1] : '4';
  // read wpa_key setting
  preg_match('@name="wpa_key"[^>]+value="([^"]*)"[^>]*@', $output, $matches);
  $formfields['wpa_key'] = isset($matches[1]) ? $matches[1] : 'defaultwpakey';

  // set new given setting
  if ( $mode == true )
  {
    $formfields['activate_guest_access'] = 'on';
    if ( $wpa_key !== false )
    {
      $formfields['wpa_key'] = $wpa_key;
    }
  }

  // do the update
  $formfields['btnSave'] = '';
  $output = $fritz->doPostForm($formfields);

  preg_match('@name="activate_guest_access"[^>]+(checked)[^>]*@', $output, $matches);
  if ( isset($matches[1]) && $mode == true )
  {
    preg_match('@name="wpa_key"[^>]+value="([^"]*)"[^>]*@', $output, $matches);
    if ( isset($matches[1]) )
    {
      $message .= 'WLAN guest access is now active. WPA-Key is "' . $matches[1] . '"';
    }
  }
  else if ( !isset($matches[1]) && $mode == false )
  {
    $message .= 'WLAN guest access is now inactive.';
  }
  else if ( isset($matches[1]) && $mode == false )
  {
    $message .= 'ERROR: WLAN guest access status change failed, should be inactive, but is still active.';
  }
  else if ( !isset($matches[1]) && $mode == true )
  {
    $message .= 'ERROR: WLAN guest access status change failed, should be active, but is still inactive.';
  }
}
catch (Exception $e)
{
  $message .= $e->getMessage();
}

// log the result
if ( isset($fritz) && is_object($fritz) && get_class($fritz) == 'fritzbox_api' )
{
  $fritz->logMessage($message);
}
else
{
  echo($message);
}
$fritz = null; // destroy the object to log out
?>

das müsste gehen mit viel Glück,
aber auf der FB 7490 06.25.30758 ging es nicht,
nur auf der FB 7390 05.58

;)
 
Bei meiner FB 6340 geht der Aufruf

Code:
php -f fritzbox_guestwlan_V2_on_off.php 1 4

mit obigem Skript leider nicht. Das GuestWLAN wird immer unverschlüsselt aktiviert.
 
Dann Aktiviere es mal in der Box, danach müsste es auch mit dem Script gehen,
denn wenn es zuvor auf unverschlüsselt steht dann bleibt es auch so.
 
fritzbox_led_display_on_off_lua.php
PHP:
<?php
/**
 * Fritz!Box PHP tools CLI script to enable or disable LED Display
 *
 * Must be called via a command line, shows a help message if called without any or an invalid argument
 * Can log to the console or a logfile or be silent
 * new in v0.2: Can handle remote config mode via https://example.dyndns.org
 * new in v0.3: Refactored code to match API version 0.5
 *
 * Check the config file fritzbox.conf.php!
 *
 * @author   Gregor Nathanael Meyer <Gregor [at] der-meyer.de>
 * @license  http://creativecommons.org/licenses/by-sa/3.0/de/ Creative Commons cc-by-sa
 * @version  0.4 2013-01-02
 * @package  Fritz!Box PHP tools
 *
 * Geändert: 01.07.2015 mit query.lua ab Firmware Version xxx.05.5x
 * '/system/led_display.lua'
 * fritzbox_led_display_on_off_lua.php
 *
 */

try
{
  // load the fritzbox_api class
  require_once('fritzbox_api.class.php');
  $fritz = new fritzbox_api();

  // init the output message
  $message = date('Y-m-d H:i') . ' ';

  // handle the CLI arguments or give a help message
  if (isset($argv[1]) && ($argv[1] == 0 || $argv[1] == 1 || $argv[1] == 2) )
  {
    $mode = (int)$argv[1];
  }
  else
  {
    if ( $fritz->config->getItem('logging') == 'console' )
    {
      echo '
  Enables or disables an LED Display of a Fritz!Box

  Usage on UNIX systems:
    /path/to/php ' .  $argv[0] . ' {0|1}

  Usage on Windows systems:
    c:\path\to\php.exe ' .  $argv[0] . ' {0|1}

  1 disable the LED Display
  0 enable the LED Display

      ';
    }
    else
    {
      $fritz->logMessage($message . 'ERROR: Script was called without or with an invalid argument');
    }
    exit;
  }

  // LED Display Status mode = 0|1|2
  if ($mode == 0 || $mode == 1 || $mode == 2)
  {
    $formfields = array(
      'getpage' => '/query.lua',
      'LED_Display' => 'box:settings/led_display'
    );

    $output = $fritz->doGetRequest($formfields);

    $output_o = json_decode($output);

    // LED Display Status mode = 2
    if ($mode == 2)
    {
//      $message .= "LED_Display: ".$output_o->{'LED_Display'};
      $message .= $output_o->{'LED_Display'} == 0 ? 'LED Display' . ' enabled' : 'LED Display' . ' disabled';
    }
  }

  if ($mode == 0 || $mode == 1)
  {

    if ($mode == 1) $mode = 2;

    // update the setting
    if ($output_o->{'LED_Display'} != $mode)
    {

      $formfields = array(
        'getpage' => '/system/led_display.lua',
        'led_display' => $mode,
        'apply' => ''
      );

      $dummy = $fritz->doPostForm($formfields);

// LED-Anzeige aus
// led {
//        infoled_reason = 0;
//        control = led_off;
//        button_events_disable = no;
// }

// LED-Anzeige an
// led {
//        infoled_reason = 0;
//        control = led_on;
//        button_events_disable = no;
// }

    }

    // check if the update succeded
    $formfields = array(
      'getpage' => '/query.lua',
      'LED_Display' => 'box:settings/led_display'
    );

    $output = $fritz->doGetRequest($formfields);

    preg_match('@"LED_Display": "([210])"@i', $output, $matches);

    if (isset($matches[1]) && $matches[1] == $mode)
    {
      $message .= $mode == 0 ? 'LED Display' . ' enabled' : 'LED Display' . ' disabled';
    }
    else if (isset($matches[1]))
    {
      $message .= 'ERROR: LED Display' . ' status change failed, should be ' . $mode . ', but is ' . $matches[1];
    }
    else
    {
      $message .= 'NOTICE: LED Display' . ' status change could have failed, should be ' . $mode . ' now, but I don\'t now if it actually is. Check your check section in the script.';
    }
  } // mode = 0|1
}
catch (Exception $e)
{
  $message .= $e->getMessage();
}

// log the result
if ( isset($fritz) && is_object($fritz) && get_class($fritz) == 'fritzbox_api' )
{
  $fritz->logMessage($message);
}
else
{
  echo($message);
}

$fritz = null; // destroy the object to log out

?>

fritzbox_led_display_on_off_lua.php 1 off
fritzbox_led_display_on_off_lua.php 0 on

fritzbox_led_display_on_off_lua.php 2 Status Anzeigen

Geht ab Firmware Version xxx.05.5x
und Beta/Labor ab Version xxx.06.25 / 113.06.35
 
Ist das Projekt Fritz!Box API für PHP hier jetzt erledigt,
oder Laufen noch einige Scripte bei euch mit der Finalen Firmware Version xxx.06.30 ,
wenn ja welche ?

:confused: :meinemei: :bluescre:
 

Neueste Beiträge

Statistik des Forums

Themen
244,882
Beiträge
2,220,093
Mitglieder
371,611
Neuestes Mitglied
Mandylion73
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.