Re: LDAP Listing
| From: | Fredrik Wahlberg | Date: | Wed, 28 Feb 2001 08:31:32 +0000 |
| Subject: | Re: LDAP Listing | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-41964@lists.php.net to get a copy of this message | ||
This is a small test I wrote a couple of days ago that does just that.
Hope it works for you.
/Fredrik
<?php
$ldapserver = "orchide.habeebee.com";
$basedn = "dc=habeebee, dc=com";
$dir =ldap_connect($ldapserver); // Connect to server
if ($dir) {
ldap_bind($dir); // Bind to the server
$result = ldap_search($dir, $basedn, "sn=*"); // query connection, set
the base and look for any sn
$info = ldap_get_entries($dir, $result); // The results get sent to
the $info object
for ($i=0; $i<$info["count"]; $i++) { // Count is a ldap feature that
contains the length of the resultset
echo $info[$i]["cn"][0]; // choose any parameter you want see here
}
ldap_close($dir);
}
?>
>>>>>>>>>>>>>>>>>> Ursprungligt meddelande
>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<
Mike Tuller <mitull01@willy.wsc.edu> skrev 2001-02-28, kl. 01:31:09
angående ämnet [PHP] LDAP Listing:
> I want to create a list of everyone on the LDAP server, and none of the
> examples I have in my books seems to work. What functions should I use to
> connect to the server, and list users in the LDAP to create a phone book
> type list to print out? Could someone also give me some sort of example
that
> I can look at?
> Mike Tuller
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net