1

Im currenlty using the following ADLDAP repository: http://adldap.sourceforge.net/

On a page I am just currently trying to achieve: taking a list of users in a certain AD Group and put it into a dropdown for me to select in HTML. Right now I have this and I have not yet got it to show any users in the group yet:

include (dirname(__FILE__) . "/../src/adLDAP.php");
    try {
        $adldap = new adLDAP();
    }
    catch (adLDAPException $e) {
        echo $e; 
        exit();   
    }

    $users = $adldap->group()->members('Group_X');
    echo $users;

Could someone please help me and guide me in the right direction to pull a list of users from a group in AD and make it be able to be used in a dropdown menu.

Kara
  • 6,115
  • 16
  • 50
  • 57

1 Answers1

2

If you use Adldap2 you could do this:

$group = $adldap->search()->groups()->find('Accounting');

$users = $group->getMembers();

foreach ($users as $user) {

    echo $user->getCommonName();    

}
Steve Bauman
  • 8,165
  • 7
  • 40
  • 56