LDAP query for exzilla.com"; echo "Connecting ..."; $ds=ldap_connect("dec4100.exzilla.net"); // must be a valid LDAP server! echo "connect result is ".$ds."

"; if ($ds) { echo "Binding ..."; $r=ldap_bind($ds); // this is an "anonymous" bind, typically // read-only access echo "Bind result is ".$r."

"; echo "Searching for (sn=S*) ..."; // Search surname entry $sr=ldap_search($ds,"dc=exzilla,dc=com", "sn=graham"); echo "Search result is ".$sr."

"; echo "Number of entires returned is ".ldap_count_entries($ds,$sr)."

"; echo "Getting entries ...

"; $info = ldap_get_entries($ds, $sr); echo "Data for ".$info["count"]." items returned:

"; for ($i=0; $i<$info["count"]; $i++) { echo "dn is: ". $info[$i]["dn"] ."
"; echo "first cn entry is: ". $info[$i]["cn"][0] ."
"; echo "first email entry is: ". $info[$i]["mail"][0] ."
"; echo "Title entry is: ". $info[$i]["title"][0] ."

"; } echo "Closing connection"; ldap_close($ds); } else { echo "

Unable to connect to LDAP server

"; } ?>