I've been getting entries from an Active Directory server through LDAP for a while now. Here's some example code:

//connect and bind
//$ds should be the handle returned from ldap_connect

//Search LDAP for all users
// note, your OU entries may differ
$sr = ldap_search($ds,
'OU=Employees,OU=Active Accounts,DC=whatever,DC=com', 'CN=*');

// Put the returned data into an array
$info = ldap_get_entries($ds, $sr);

//loop through all the users and display their name
for($i = 0; $i < $info['count']; $i++) {
  echo $info[$i]['cn'][0]."\n";
}


If you need an LDAP Browser, I suggest Softerra LDAP Browser. It's very nice for finding OU's and such.


Justin Patrin


Redmond Militante wrote:
hi all

my first email to the list re: php/ldap/win2k AD garnered no responses. i've got most of the problem solved, however i can't get attributes from the ldap server.

i have a login script that authenticates against our win2k active directory domain controller. i'm able to open a connection/bind/verify a password/and close the connection. i'm really having trouble returning a user's attributes (i'm mainly concerned with firstname and last name - cn and givenname).

i've been trying for several days to return attributes. has anyone accomplished this with php? i can't find much relevant info for this particular problem on the internet. if you have any pointers, i'd appreciate hearing them.

i'd post relevant code, but nothing i've tried works, and i'm not sure if the code i've tried is even valid...

thanks

redmond

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to