Ldap question: Getting List os AD users

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fcaserio
Forum Newbie
Posts: 6
Joined: Wed Jan 21, 2009 6:20 am

Ldap question: Getting List os AD users

Post by fcaserio »

I have large experience with PHP but zero contact to LDAP so far.

I'm dealing with a new application that has to list all users on an Active Directory (AD 2000).

I can connect and bind to the AD server, but I don't understand how to search the AD users.

Any help is appreciated

tks
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Ldap question: Getting List os AD users

Post by pickle »

I have no experience with Active Directory, but I have worked with LDAP in Novell Directory Services for a few years. I've never needed to get a list of all users, so my solution might be a bit off. What you can do though, is search for all entities of a particular type.

For example

Code: Select all

$filter='(ObjectClass=user)';
$results = ldap_search($link,'ou=Users,o=YourOrganization',$filter);
$entries = ldap_get_entries($link,$results);
Of course, you should change your filter and ldap_search()'s second argument to match your setup.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply