/dev/null"); if ($netOutput) { $parts = preg_split('/\s+/', trim($netOutput)); foreach ($parts as $foundIp) { $foundIp = trim($foundIp); if ($foundIp && $foundIp !== '127.0.0.1') { $detectedNetworkInterfaces[$foundIp] = $foundIp . ' (LAN)'; } } } } } // Default host: Always use the HTTP host requested by client (e.g. demo.e-atria.net), // unless on localhost with detected LAN Wi-Fi if (!$isLocalDev || empty($detectedNetworkInterfaces)) { $defaultHost = $httpHost; } else { $defaultIp = ''; foreach ($detectedNetworkInterfaces as $ipKey => $ipLabel) { if (stripos($ipLabel, 'Wi-Fi') !== false || stripos($ipLabel, 'Wireless') !== false) { $defaultIp = $ipKey; break; } } if (!$defaultIp) { $defaultIp = array_key_first($detectedNetworkInterfaces); } $defaultHost = $defaultIp . ':' . $serverPort; } ?>