To configure manually a WiFi network, I need the hexadecimal key.
In Ubuntu, I can obtain it with this comand:
wpa_passphrase network passphrase
And the result is:
network={
ssid="network"
#psk="passphrase"
psk=72feda58f99812cd6a4a075047270e361e3ae18f8cb191eb8d55ac07f928a466
}
Then.. How can I obtain the psk with PHP?
EDIT: I do this:
<?php
$fp = fopen("data.txt", "w+");
if(!$fp) die ("Errore nell'apertura del file");
exec("wpa_passphrase network passphrase",$output);
$conf = "";
for($i=0;$i<5;$i++)
$conf .= $output[$i]."";
fwrite($fp,$conf);
fclose($fp);
exec("sudo cp data.txt /etc/wpa_supplicant.conf"); //this doesn't work!
echo "ok<br>".$conf
?>