Using LDAP queries within PHP to commune with Active Directory- problems?

  • Thread starter Thread starter [ J ] a [ Y ]
  • Start date Start date
J

[ J ] a [ Y ]

Guest
Hi all. As the title says, I'm trying to use LDAP in PHP to commune with Active Directory (I'm using the OpenLDAP DLL's). I keep getting this error message though, and I cant figure out why. The error message is: "Warning: ldap_search() [function.ldap-search]: Search: Operations error in G:\inetpub\wwwroot\sites\IS\tests\ldap.php on line 14". Here's the code:

Code:
<?php

$con = ldap_connect("ldap://ALPHA.RB.NET");

if($con)
{
  $bind = ldap_bind($con);
  
  $dn= "OU=Users,OU=WRD,OU=AU,OU=ANZ,
            DC=alpha,DC=rb,DC=net";
  
  $filter = "(cn=*)";
  $search = array("displayname");
  
  $result = ldap_search($con, $dn, $filter, $search);
}
else
{
  echo "Couldnt connect <br>";
}

?>

I had a hunch that it was something to do with me misentering the base DN or something like that, so here's a screenshot of my Active Directory:

http://img99.imageshack.us/img99/9633/testfj7.png

Thanks heaps in advance for any replies.
my goal is to be able to find the email address of a registered user given their login ID (this info is stored in AD).

Line 14 is the ldap_search() function, and I'm not sure why its messing up.
 
Back
Top