This one is really puzzling... It has taken me days..
I need to do an LDAP search to an Active Directory server. I was able to connect and bind to the server fine, but my searches are always in vain. OK, here we go: box name: mydomain-71.mydomain.myschools.org domain name: mydomain.myschools.org user to search: [EMAIL PROTECTED] (names and and passwords are of course ficticious) my code: <? $user_dn = "[EMAIL PROTECTED]"; $base_dn = "dc=mydomain,dc=myschools,dc=org"; $server = "mydomain-71.mydomain.myschools.org"; echo $conn = ldap_connect($server); echo "AUTH: ". $bind = ldap_bind($conn, $user_dn,"password"); $user = "ez"; $filter = (|(name=$name*)(displayname=$name*)(cn=$name*)); $res = ldap_search($conn,$base_dn,$filter); $info = ldap_get_entries($conn, $res); print_r($info); ?> it gives me: Resource id #1 AUTH: 1 Warning: LDAP: Unable to perform the search: can't contact LDAP server in ldap_test.php on line 16 Warning: ldap_get_entres(): supplied argument is not a valid ldap result resource blah blah... Now, I was able to connect and authenticate to it, but why ldap_search() says that I can't connect to it? If I change $base_dn to "dc=mydomain-71,dc=mydomain,dc=myschools,dc=org"; The error message is changed to : Unable to perform the search: No such object in ldap_test.php on line 16. It doesn't complain about not being able to connect anymore! But of course the search fails because the domain really is only mydomain.myschools.org. What on earth did I do wrong?? Thanks, ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php