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

14 lines
305 B
PHP
Raw Permalink Normal View History

2017-02-16 15:29:55 +00:00
<?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";
}