function GetAddonInfos()
{
    $data_url = '/igdupnp/control/WANCommonIFC1';
    $data_soap = '"urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1#GetAddonInfos"';
    $data_xml = '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetAddonInfos xmlns:u=urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1 /></s:Body></s:Envelope>';
    $tmp = DoCurl($data_url, $data_soap, $data_xml);
    $data_result = array();
    $data_result['NewByteReceiveRate'] = FindKey($tmp, "NewByteReceiveRate");
    $data_result['NewByteSendRate'] = FindKey($tmp, "NewByteSendRate");
    $data_result['NewTotalBytesSent'] = FindKey($tmp, "NewTotalBytesSent");
    $data_result['NewTotalBytesReceived'] = FindKey($tmp, "NewTotalBytesReceived");
    return $data_result;
}
Beispiel #2
0
function FindKey($aKey, $array)
{
    if (is_array($array)) {
        foreach ($array as $key => $item) {
            if ($key == $aKey) {
                return $item;
            } else {
                $result = FindKey($aKey, $item);
                if ($result != false) {
                    return $result;
                }
            }
        }
    }
    return false;
}