/** * Set Ethernet static IP address */ function setEthIP($ip) { $ip = '169.254.1.' . $ip; $networkConfiguration = networkConfiguration(); setNetworkConfiguration($ip, $networkConfiguration['wifi']); $response = shell_exec("sudo service networking reload"); }
/** * Set Wlan */ function setWifi($ssid, $password, $type = "WPA") { $networkConfiguration = networkConfiguration(); setNetworkConfiguration($networkConfiguration['eth'], array('ssid' => $ssid, 'password' => $password, 'type' => $type)); $response = shell_exec("sudo service networking reload"); if (strpos($response, 'PING') !== false || strpos($response, 'errors') !== false) { return false; } else { return true; } }