The content of this forum post has been removed and can no longer be accessed.
Totara Learn Open Discussions
This forum discussion has been removed
This forum post has been removed
Hi Deva
It looks like someone has answered your post in another forum.
?php
$ldap_host = 'xx.xxx.xx.xxx'; // IP of your LDAP server
$ldap_port = 389;
$ldap_user = 'username'; // user to bind to server
$ldap_pass = '******'; // password
$ldap_context = 'ou=users,dc=example, dc=org'; // where the infos are
// https://stackoverflow.com/questions/36640272/read-deleted-users-from-active-directory
$filter = '(&(objectClass=user)(isDeleted=TRUE))'; $ldap = ldap_connect($ldap_host, $ldap_port);
if (!$ldap) {
die("\nERROR: no connection\n");
} else {
echo "connect OK!\n";
} // https://stackoverflow.com/questions/6222641/how-to-php-ldap-search-to-get-user-ou-if-i-dont-know-the-ou-for-base-dn#6222836
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); $ldap_bind = ldap_bind($ldap, $ldap_user, $ldap_pass);
if (!$ldap_bind) {
die("\nERROR: can not bind\n");
} else {
echo "bind OK!\n";
} $search = ldap_search($ldap, $ldap_context, $filter);
$info = ldap_get_entries($ldap, $search);
echo "data for " . $info["count"] . " items returned:\n\n"; for ($i=0; $i<$info["count"]; ++$i) {
echo $i + 1, " entry:\n";
echo "dn is: " . $info[$i]["dn"] . "\n";
echo "\n----\n";
} ldap_close($ldap);
It works for me on general searches, but I do not get deleted users (as your link says).
regardsCraig
This forum post has been removed
The content of this forum post has been removed and can no longer be accessed.