Page 1 of 1

ldap_search and m$ LDAP

Posted: Wed Jul 26, 2006 4:30 pm
by rcmn
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Code: Select all

$ldap_host = "ldapserver.com";
   $base_dn = "DC=foo,DC=bar,DC=com";
$filter = "smith";
   
   $connect = ldap_connect($ldap_host);
   $bind = ldap_bind($connect);
   $read = ldap_search($connect, $base_dn,"cn=*$filter*" );
  
   $info = ldap_get_entries($connect, $read);
   echo $info["count"];
and i get the following error
Warning: ldap_search(): Search: Operations error in mypage.php on line 07

Warning: ldap_get_entries(): supplied argument is not a valid ldap result resource in mypage.php on line 09
so it pass the connect and the bind but something is wrong after that.And i tried different things but i keep having errors.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Jul 26, 2006 8:37 pm
by neophyte
I've connected with ldap function to AD in a windows environment. It would appear that you are not connected. The trick for me was getting my base dn path right ($base_dn). There's a utility you can use to explore the tree. I can't recall it's name right now. But when you get that right the rest should fall into place for you. Good luck.

Posted: Thu Jul 27, 2006 1:52 pm
by rcmn
u were right i wasn't connecting i had the error #16.
And that post helped me solve my issues.