Link to home
Create AccountLog in
Avatar of whozie
whozie

asked on

dsquery ldap php

Very noobish with ldap/dsquery. Simple question:

How can I do a dsquery in php and interpret the results. What i'm ultimately trying to do is simply get all the groups that exist only in this directory (no duplicates, just unique/distinct list).

The dsquery I'd like to use is:

dsquery group OU=Users and Groups,DC=Applications,DC=MHGroups


I'd probably need to format it with the -o option also.

ASKER CERTIFIED SOLUTION
Avatar of Marcus Bointon
Marcus Bointon
Flag of France image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of whozie
whozie

ASKER

How do you actually call the query in php though? eg: ldap_search() ??
Yes, ldap_search() is the thing to use. You'll need to get the results of it using ldap_get_entries() and so on.
Avatar of whozie

ASKER

do I just put "dsquery group" in the filter?

function all_groups() {
            if($this->_bind) {
                  $sr=ldap_search($this->_conn,$this->_base_dn,"dsquery group");
                  $entries = ldap_get_entries($this->_conn, $sr);
                  return $entries;
            }
      }