javascriptphplinuxwifiwireless

How to connect to WIFI from a browser with Javascript and PHP?


I working on creating a Linux Digital signage Box, which my clients can buy, and choose what to show on it. At the moment, it boot up in Firefox, check if it have internet, query my server and get a unique URL which Firefox change to. If it don't have any internet connection, i show a page "You dont have internet, please connect a ethernet cable or connect to WIFI."

That my question, what will be the best way to allow my client to connect a Wireless hotspot from Firefox? At the moment my idea is:

I add a "Connect wireless" button, which with some javascript call a php script, which SSH to the BOX (localhost), and use connmanctl to first, find all WIFI hotspot and if they reguire password. The Javascript then show this, and SSH again to connect and so on..

Do you know a opensource system, which do that? or a better way to do it?


Solution

  • This is what i would do.
    You can run system code with the function shell_exec. Use this function in your PHP script to execute the native WiFi connection possibilities of your Linux distribution. How to do this for your distro is most likey answered here.
    Good luck!