Bitte schön. Ausführen als Script.
<?
$fritzbox_ip = 'fritz.box';
$fritzgui = 'http://fritz.box/cgi-bin/webcm';
$fritzseite = '../html/de/menus/menu2.html';
$password = 'xxxxx';
$aus = '0';
$ch = curl_init('http://' . $fritzbox_ip . '/cgi-bin/webcm?getpage=../html/login_sid.xml');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$login = curl_exec($ch);
curl_close($ch);
$session_status_simplexml = simplexml_load_string($login);
if ($session_status_simplexml->iswriteaccess == 1)
{
$SID = $session_status_simplexml->SID;
}
else
{
$challenge = $session_status_simplexml->Challenge;
$response = $challenge . '-' . md5(mb_convert_encoding($challenge . '-' . $password, "UCS-2LE", "UTF-8"));
$login = array('getpage' => $fritzseite, 'login:command/response' => $response);
$sendlogin = http_post_fields($fritzgui, $login);
preg_match('@<input type="hidden" name="sid" value="([A-Fa-f0-9]{16})" id="uiPostSid">@i', $sendlogin, $matches);
if (isset($matches[1]) && $matches[1] != '0000000000000000')
{
$SID = $matches[1];
}
else
{
echo "Fehler: Login fehlgeschlagen";
return;
}
}
$clearjournal = http_post_fields($fritzgui, array('getpage' => $fritzseite, 'sid' => $SID, 'var:pagename' => 'foncalls', 'telcfg:settings/ClearJournal' => $aus));
$logout = array('getpage' => $fritzseite, 'sid' => $SID, 'security:command/logout' => 'logout');
$sendlogout = http_post_fields($fritzgui, $logout);
?>