Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ldap_control_paged_result(3) [php man page]

LDAP_CONTROL_PAGED_RESULT(3)						 1					      LDAP_CONTROL_PAGED_RESULT(3)

ldap_control_paged_result - Send LDAP pagination control

SYNOPSIS
bool ldap_control_paged_result (resource $link, int $pagesize, [bool $iscritical = false], [string $cookie = ""]) DESCRIPTION
Enable LDAP pagination by sending the pagination control (page size, cookie...). PARAMETERS
o $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 VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
The 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 != ''); NOTES
Note Pagination control is a LDAPv3 protocol feature. SEE ALSO
ldap_control_paged_result_response(3), RFC2696 : LDAP Control Extension for Simple Paged Results Manipulation. PHP Documentation Group LDAP_CONTROL_PAGED_RESULT(3)

Check Out this Related Man Page

Net::LDAP::Control::Paged(3)				User Contributed Perl Documentation			      Net::LDAP::Control::Paged(3)

NAME
Net::LDAP::Control::Paged - LDAPv3 Paged results control object SYNOPSIS
use Net::LDAP; use Net::LDAP::Control::Paged; use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED ); $ldap = Net::LDAP->new( "ldap.mydomain.eg" ); $page = Net::LDAP::Control::Paged->new( size => 100 ); @args = ( base => "cn=subnets,cn=sites,cn=configuration,$BASE_DN", scope => "subtree", filter => "(objectClass=subnet)", callback => &process_entry, # Call this sub for each entry control => [ $page ], ); my $cookie; while(1) { # Perform search my $mesg = $ldap->search( @args ); # Only continue on LDAP_SUCCESS $mesg->code and last; # Get cookie from paged control my($resp) = $mesg->control( LDAP_CONTROL_PAGED ) or last; $cookie = $resp->cookie or last; # Set cookie in paged control $page->cookie($cookie); } if ($cookie) { # We had an abnormal exit, so let the server know we do not want any more $page->cookie($cookie); $page->size(0); $ldap->search( @args ); } DESCRIPTION
"Net::LDAP::Control::Paged" provides an interface for the creation and manipulation of objects that represent the "pagedResultsControl" as described by RFC-2696. CONSTRUCTOR ARGUMENTS
In addition to the constructor arguments described in Net::LDAP::Control the following are provided. cookie The value to use as the cookie. This is not normally set when an object is created, but is set from the cookie value returned by the server. This associates a search with a previous search, so the server knows to return the page of entries following the entries it returned the previous time. size The page size that is required. This is the maximum number of entries that the server will return to the search request. METHODS
As with Net::LDAP::Control each constructor argument described above is also avaliable as a method on the object which will return the current value for the attribute if called without an argument, and set a new value for the attribute if called with an argument. SEE ALSO
Net::LDAP, Net::LDAP::Control, http://www.ietf.org/rfc/rfc2696.txt AUTHOR
Graham Barr <gbarr@pobox.com> Please report any bugs, or post any suggestions, to the perl-ldap mailing list <perl-ldap@perl.org> COPYRIGHT
Copyright (c) 2000-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.1 2010-03-12 Net::LDAP::Control::Paged(3)
Man Page