😕
Hi All,
I have tried to retrieve information from my ldap server.
The connection, binding works fine.
But when I tried to use the ldap_search function with filter rdn=
or cn= or uid=*. It does not return any result.
I also tried with rdn=john or uid=john or cn=john*, but also no result return.
If I try with rdn=john or uid=john or cn=john there is one result return.
Why the filter does not recognised the wild card '*'?
Any ideas, please help.
<?php
// Connect to the directory server.
$ad = ldap_connect("myldap.com")
or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 2);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);
// Bind to the directory server.
$bd = ldap_bind($ad) or
die("Couldn't bind to AD!");
echo "SUCCESS!";
// Carry out directory server-specific tasks.
$filter = "rdn=*"; //does not work
//$filter = "rdn=john*"; //does not work
//$filter = "rdn=john"; //return one result
$result = ldap_search($ad, " ", $filter);
$entries = ldap_get_entries($ad, $result);
print_r($entries);
// Close the connection
ldap_unbind($ad);