tags:

views:

368

answers:

3

I want to display the list of shared drives connected to my system running Windows. Is there any tutorial for this?

I have tried the following code in PHP:

echo "<select id = 'drives'><option>Drives</option>";
for ($ii=66;$ii<92;$ii++) 
{
    $char = chr($ii);
    if (opendir($char.":/"))
        echo "<option>".$char."</option>";
}
echo "</select>";
A: 

This may help to do it under c#. http://www.codeproject.com/KB/IP/networkshares.aspx I can't find any way to do it directly under php.

To use this with your php you may need make this as a dll and call it from php using the Win32 api functions.

Dave
it's ok , in php is there any function to open a remote directory directly ?(i specify the drive letter before the program runs)
Sakthivel
A: 

May I ask what you need this for, so we can get a bit of context and hopefully help in some way?

Justin Lawrence
i am a employee , My boss assign this task to me . Anyway thanks for you interest..
Sakthivel
@sakthiopr, as a better question please. He wasn't asking who assigned the task. We need to know what you are trying to do. You need to tell us the context of your question. PHP usually runs on a web server. Asking about mapped drives doesn't make any sense.
Zoredache
+1  A: 

You have to use the experimental Win32 API functions in PHP:

  1. Register the API function GetDriveType using w32api-register-function.
  2. After that you can call this function either by using w32api-invoke-function or by directly calling GetDriveType. It depends on your PHP version. (See the user contributed note at the bottom of the documentation of w32api-invoke-function!)
  3. Check the return value if it is DRIVE_REMOTE. You can find the required parameters and the list of other return values at the MSDN documentation of GetDriveType.
DR