Its prototype follows:
CHAPTER 17 ?– PHP A ND LDAP 431
resource ldap_search(resource link_id, string base_dn, string filter
[, array attributes [, int attributes_only [, int size_limit
[, int time_limit [int deref]]]]])
A successful search returns a result set, which can then be parsed by other functions,
which are introduced later in this section; a failed search returns FALSE. Consider
the following example in which ldap_search() is used to retrieve all users with a first
name beginning with the letter A:
$results = ldap_search($connection, "dc=OpenLDAP,dc=Org", "givenName=A*");
Several optional attributes tweak the search behavior. The first, attributes, allows you
to specify exactly which attributes should be returned for each entry in the result set.
For example, if you want to obtain each user??™s last name and e-mail address, you
could include these in the attributes list:
$results = ldap_search($connection, "dc=OpenLDAP,dc=Org", "givenName=A*",
"surname,mail");
Note that if the attributes parameter is not explicitly assigned, all attributes will
be returned for each entry, which is inefficient if you??™re not going to use all of them.
If the optional attributes_only parameter is enabled (set to 1), only the attribute
types are retrieved. You might use this parameter if you??™re only interested in knowing
whether a particular attribute is available in a given entry and you??™re not interested in
the actual values.
Pages:
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511