我已经成功验证了php中的ldap,但我无法在搜索过程中检索信息。此广告身份验证在.net应用程序中工作正常但在php中我在搜索期间未收到任何信息。
$search_filter = "(sAMAccountName=*xyz*)" ;
$attributes = array("memberof","givenname");
$ldap = ldap_connect($server);
if($ldap)
echo "successful";
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); // generally needed with AD.
//ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 2.4);
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
$ldapbind = ldap_bind($ldap,$username,$password);
if ($ldapbind) {
echo "<br> LDAP Connect successful...";
} else {
echo "<br>LDAP Connect failed...";
}
$search = ldap_search($ldap, $base_dn, $search_filter);
$data = ldap_get_entries($ldap, $search);