"; $lc = ldap_connect("127.0.0.1"); ldap_set_option($lc, LDAP_OPT_PROTOCOL_VERSION, 3); if (!ldap_start_tls($lc)) { echo "

Unable to connect to the LDAP server!

"; echo ""; exit; } echo "

LDAP query results

"; ldap_bind($lc); // Search users in the group with gid 100 $base = "ou=People,dc=intra"; $filt = "gidNumber=100"; $sr = ldap_search($lc, $base, $filt); $info = ldap_get_entries($lc, $sr); echo "Searched from base " . $base . " with filter " . $filt . ".

"; for ($i = 0; $i < $info["count"]; $i++) { echo "Match " . $i . ": " . $info[$i]["cn"][0]; echo " (e-mail: " . $info[$i]["mail"][0] . ")
"; } if ($i == 0) { echo "No matches found!"; } ldap_close($lc); echo ""; ?>