Hi All,

 I want to check is the mobile connected with my computer thr usb connection or not ?

 How to check it in php ?

JN

    I don't know of a method for detecting USB connectivity with PHP. There are some other languages that cover it though. Check here for a VB solution:

    http://bytes.com/topic/visual-basic-net/answers/348267-how-detect-usb-device-being-plugged-unplugged

    The only way I can think that PHP would work in this situation is if your phone maps a drive so you can then use a file function to see if the file exists. This is a problem though if your mobile ever maps a different drive letter.

      You may have to write a custom extension for that, see here for that info.

      It does matter if the server is Windows or Linux.

      You may be able to do it without an extension in either one of the OS's, if you use the exec command and parse the output.

      For instance, Windows DEVCON will allow you to list the currently connected USB devices, with "devcon listclass usb".

      Please note though, this is NOT intended for use from the server side, and you can do severe damage to your system with it, also it will cause problems in Vista since it needs to be run as administrator.

      The source code for this is available through the Windows DDK, thus you can use those examples, or or some of the methods to get what you are looking for in C++, the adapt it to work as a Win32 PHP Extension.

      On another note:

      (edit: originally mentioned to check for list of files, but realized it was already said, sorry!)

      Best of luck with this endeavor.

        Write a Reply...