Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

$attribute = ldap_first_attribute($ldap, $entry,
&$pointer);
while($attribute)
{
print("$attribute
\n");
$attribute = ldap_next_attribute($ldap,$entry,
&$pointer);
}


ldap_free_result($result);
?>


integer ldap_next_entry(integer link, integer entry)


The ldap_next_entry function returns the next entry in a result set. Use
ldap_first_entry to get the first entry in a result set.


<?


//connect to LDAP server
if(!($ldap=ldap_connect("ldap.itd.umich.edu")))
{
die("Could not connect to LDAP server!");
}


// list organizations in the US
$dn = "o=University of Michigan, c=US";
$filter = "objectClass=*";


//perform search
if(!($result = ldap_list($ldap, $dn, $filter)))
{
die("Nothing Found!");
}


//get each entry
$entry = ldap_first_entry($ldap, $result);
do
{
//dump all attributes for each entry
$attribute = ldap_get_attributes($ldap,
$entry);
print("

");
var_dump($attribute);

Free download pdf