php-upnp/examples/get-gateway-ip.php

14 lines
305 B
PHP

<?php
require_once __DIR__."/../vendor/autoload.php";
use NoccyLabs\UPnP\SSDP\Discovery;
use NoccyLabs\UPnP\SSDP\SearchTarget;
$discovery = new Discovery();
$discovery->discover(SearchTarget::URN_SCHEMA_DEVICE_IGD_2);
foreach ($discovery as $device) {
echo "Gateway IP: ".$device->getIp()."\n";
}