I have a LDAP server where I have all registered users. There is over than 3000 users and LDAP has 1000 entries limit for one search result. I need to have all users in one 'array' for json and administration and so on.
There is my code for search result over than 1000 entries:
$bind = ldap_bind($ds, $dn, $ldapconfig['password']);
$pageSize = 100;
$cookie = '';
$i = 0;
$attributes = array("email", "verificationHash", "gn", "sn");
do {
ldap_control_paged_result($ds, $pageSize, true, $cookie);
$filter = '(&(objectClass=Client))';
$result = ldap_search($ds, $baseDN, $filter, $attributes);
$entries = ldap_get_entries($ds, $result);
array_shift( $entries );
$usersJSON = json_encode( $entries );
header('Content-Type: application/json');
echo $usersJSON; // return all users from ldap (over 3000)
ldap_control_paged_result_response($ds, $result, $cookie);
} while($cookie !== null && $cookie != '');
// return array for javascript
$output = json_encode(
array(
'status' => true,
'text' => 'Something',
'data' => $entries
)
);
die($output);
On front-end I need whole array but I get just first 100 entries. How can I split that result of cycles to one variable array?