Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user='cn=administrator,cn=users,dc=contoso,dc=com';
- $pass=‘xxxxxxx';
- $ds=ldap_connect("172.16.32.6");
- if ($ds) {
- ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
- $r=ldap_bind($ds, $user, $pass);
- $sr=ldap_search($ds,"dc=contoso,dc=com", “cn=b*");
- echo "Number of entires returned: ".ldap_count_entries($ds,$sr)."<p>";
- $info = ldap_get_entries($ds, $sr);
- for ($i=0; $i<$info["count"]; $i++) {
- echo "dn is: ". $info[$i]["dn"] ."<br>";
- echo "cn is: ". $info[$i]["cn"][0] ."<br><br>";
- }
- ldap_close($ds);
- } else {
- echo "<h4>Unable to connect to LDAP server</h4>";
- }?>
Add Comment
Please, Sign In to add comment