I have successfully authenticated against ldap in php, but I'm not able to retrieve information during search. This Ad authentication works fine in .net application but in php I have not received any information during search.
$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);