Reputation: 1
Is it possible to detect usb mouse,keyboard or flash drives when they are connected using php?
Upvotes: 0
Views: 4083
Reputation: 2121
Which side - server side or client side?
Server side: possible, although probably not a good idea. You would call OS specific functions or shell commands to access USB (e.g. shell_exec("lsusb -v"); ), and process the results.
Client side: No. PHP just works on server side.
Commandline PHP: same as Server side.
You are using the wrong tool for the job. Go back and use one more suited to the task.
Upvotes: 4
Reputation: 2207
This is not really a matter of PHP, but of the underlying operating system. If the operating system detects it and makes the information readable for the user that runs the PHP script, you can "detect" devices using PHP.
Upvotes: 4