As the title says... Chat on...

User avatar
By zoyoo
#42624 I want to build a bandwith monitor for my router with some extra functions like reset IP or enable guest WLAN.
This php code is from a german forum. It seems to be as basic as it could get and works for my 7490:
Code: Select all<?php
// Polls data via UPNP from Fritzbox
$client = new SoapClient(
  null,
  array(
    'location'   => "http://fritz.box:49000/igdupnp/control/WANCommonIFC1",
    'uri'        => "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1",
    'soapaction' => "",
    'noroot'     => True
  )
);

$status = $client->GetCommonLinkProperties();
$status2 = $client->GetAddonInfos();
// print_r($status);
// print_r($status2);
// Convert Bits and Bites (*8)
$ByteSendRate      = $status2['NewByteSendRate']*8;
$ByteReceiveRate   = $status2['NewByteReceiveRate']*8;
echo "trafficout:",$ByteSendRate," trafficin:",$ByteReceiveRate,"";
?>


If you open up this php page in your browser it shows something like this:
trafficout:144 trafficin:256

How would this translate into the NodeMcu Lua language? It looks so easy, but I don't really see what data exactly I have to send..