PHP WiFi
GitHub:https://github.com/sanchescom/php-wifi
Packagist:https://packagist.org/packages/sanchescom/php-wifi
インストール
Composerでインストールします。
>composer require sanchescom/php-wifi
コマンド
コマンドとして利用することができます。
アクセスポイント一覧
>.\vendor\bin\wifi list
SSID BSSID Channel Quality dBm Frequency Connected Security
----------------------------------------------------------------------------------------------------
Buffalo-A-XXXX XX:c2:bf:XX:fa:cc 53 63 -67 5250 true WPA2-Personal
aterm-XXXXXX-a a4:XX:42:f1:XX:63 41 73 -62 5100 false WPA2-Personal
...
接続しているアクセスポイント一覧
>.\vendor\bin\wifi list --connected
SSID BSSID Channel Quality dBm Frequency Connected Security
----------------------------------------------------------------------------------------------------
Buffalo-A-XXXX XX:c2:bf:XX:fa:cc 53 63 -67 5250 true WPA2-Personal
切断
>.\vendor\bin\wifi disconnect --bssid=XX:c2:bf:XX:fa:cc --device=wlan
接続
>.\vendor\bin\wifi connect --bssid=XX:c2:bf:XX:fa:cc --password=password --device=wlan
PHP
index.php
<?php
include __DIR__ . '/vendor/autoload.php';
use Sanchescom\WiFi\WiFi;
$networks = WiFi::scan()->getAll();
foreach ($networks as $network) {
echo "ssid:{$network->ssid} connected:{$network->connected}\n";
}
>php index.php
ssid:Buffalo-A-XXXX connected:1
ssid:aterm-XXXXXX-a connected: