Query: ldap_control_paged_result
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
LDAP_CONTROL_PAGED_RESULT(3) 1 LDAP_CONTROL_PAGED_RESULT(3) ldap_control_paged_result - Send LDAP pagination controlSYNOPSISbool ldap_control_paged_result (resource $link, int $pagesize, [bool $iscritical = false], [string $cookie = ""])DESCRIPTIONEnable LDAP pagination by sending the pagination control (page size, cookie...).PARAMETERSo $link - An LDAP link identifier, returned by ldap_connect(3). o $pagesize - The number of entries by page. o $iscritical - Indicates whether the pagination is critical of not. If true and if the server doesn't support pagination, the search will return no result. o $cookie - An opaque structure sent by the server (ldap_control_paged_result_response(3)).RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESThe example below show the retrieval of the first page of a search paginated with one entry by page. Example #1 LDAP pagination <?php // $ds is a valid link identifier (see ldap_connect) ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); $dn = 'ou=example,dc=org'; $filter = '(|(sn=Doe*)(givenname=John*))'; $justthese = array('ou', 'sn', 'givenname', 'mail'); // enable pagination with a page size of 1. ldap_control_paged_result($ds, 1); $sr = ldap_search($ds, $dn, $filter, $justthese); $info = ldap_get_entries($ds, $sr); echo $info['count'] . ' entries returned' . PHP_EOL; The example below show the retrieval of all the result paginated with 100 entries by page. Example #2 LDAP pagination <?php // $ds is a valid link identifier (see ldap_connect) ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); $dn = 'ou=example,dc=org'; $filter = '(|(sn=Doe*)(givenname=John*))'; $justthese = array('ou', 'sn', 'givenname', 'mail'); // enable pagination with a page size of 100. $pageSize = 100; $cookie = ''; do { ldap_control_paged_result($ds, $pageSize, true, $cookie); $result = ldap_search($ds, $dn, $filter, $justthese); $entries = ldap_get_entries($ds, $result); foreach ($entries as $e) { echo $e['dn'] . PHP_EOL; } ldap_control_paged_result_response($ds, $result, $cookie); } while($cookie !== null && $cookie != '');NOTESNote Pagination control is a LDAPv3 protocol feature.SEE ALSOldap_control_paged_result_response(3), RFC2696 : LDAP Control Extension for Simple Paged Results Manipulation. PHP Documentation Group LDAP_CONTROL_PAGED_RESULT(3)
Related Man Pages |
---|
net::ldap::control::syncrequest(3) - mojave |
net::ldap::control::paged(3) - osx |
ldap_get_values(3) - php |
ldap_list(3) - php |
ldap_search(3) - php |