Moin !
Ich benutze schon eine Weile folgendes Skript:
<?
if($IPS_SENDER == "WebFront") return;
$address = "Fritz.box";
$contentRecv = 'POST /upnp/control/WANIPConn1 HTTP/1.1
Cache-Control: no-cache
Connection: Close
Pragma: no-cache
Content-Type: text/xml; charset="utf-8"
User-Agent: Microsoft-Windows/6.1 UPnP/1.0
SOAPACTION: "urn:schemas-upnp-org:service:WANIPConnection:1#GetStatusInfo"
Content-Length: '.(287+strlen($address)).'
Host: '.$address.':49000
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><m:GetStatusInfo xmlns:m="urn:schemas-upnp-org:service:WANIPConnection:1"/></SOAP-ENV:Body></SOAP-ENV:Envelope>
';
$data = SendPacket($contentRecv);
$connectionStatus = GetTextBetween($data, "<NewConnectionStatus>", "<\/NewConnectionStatus>");
if($connectionStatus == "Connected")
{
SetValue(13384 /*[Fritzbox\Verbindung\Status]*/, true);
}
else
{
SetValue(13384 /*[Fritzbox\Verbindung\Status]*/, false);
}
$lastConnectionError = GetTextBetween($data, "<NewLastConnectionError>", "<\/NewLastConnectionError>");
SetValue(20128 /*[Fritzbox\Verbindung\Verbindungsfehler]*/, $lastConnectionError);
$upTime = GetTextBetween($data, "<NewUptime>", "<\/NewUptime>");
SetValue(39161 /*[Fritzbox\Verbindung\UpTime]*/, gmstrftime('%H:%M:%S', $upTime));
function SendPacket($content)
{
global $address;
$port = 49000 /*[Objekt #49000 existiert nicht]*/;
$fp = fsockopen ($address, $port, $errno, $errstr, 10);
if (!$fp)
{
echo "$errstr ($errno)<br />
";
}
else
{
fputs ($fp, $content);
$ret = "";
while (!feof($fp))
{
$ret.= fgets($fp,128);
}
fclose($fp);
}
if(!(strpos($ret, "200 OK") === false))
{
return $ret;
}
else
{
die("Invalid Response: ".$ret);
}
}
function GetTextBetween($string, $start, $end)
{
preg_match_all("/$start(.*)$end/i", $string, $match);
return $match[1][0];
}
?>
aus Post http://www.ip-symcon.de/forum/f53/fritzbox-7270-wlan-repeater-scripts-8267/index13.html#post110362
Funktioniert auch ganz wunderbar, ich habe nur einen Wunsch, den ich mir leider nicht selbst erfüllen kann :rolleyes:
Ich würde gerne die uptime in Tagen/Monaten darstellen.
Wenn ich aber aus
$upTime = GetTextBetween($data, "<NewUptime>", "<\/NewUptime>");
SetValue(39161 /*[Fritzbox\Verbindung\UpTime]*/, gmstrftime('%H:%M:%S', $upTime));
$upTime = GetTextBetween($data, "<NewUptime>", "<\/NewUptime>");
SetValue(39161 /*[Fritzbox\Verbindung\UpTime]*/, gmstrftime ('%Y:%M:%D:%H:%M:%S', $upTime));
mache, sieht es aus wie im Anhang. Mir ist schon klar, dass ich irgendwie den unix timestamp vom aktuellen Datum abziehen muss - aber das war es dann auch schon mit meinem Verständnis…
Kann mir einer helfen ? Bitte ? ^^
Viele Grüße
Martin
mache steht dort