$ldap_host = "
***.
***.com.tw";
$base_dn = "dc=
****,dc=com,dc=tw";
$filter = "(cn=
****)";
;
//$ldap_user = "cn=
***,cn=
***,dc=
****,dc=
**,dc=
**";
$ldap_pass = "
*****";
$connect = ldap_connect( $ldap_host, $ldap_port)
or exit(">>Could not connect to LDAP server<<");
$bind = ldap_bind($connect, $ldap_user, $ldap_pass)
or exit(">>Could not bind to $ldap_host<<");
$read = ldap_search($connect, $base_dn, $filter)
or exit(">>Unable to search ldap server<<");
$info = ldap_get_entries($connect, $read);
echo $info["count"]." entries returned
";
$ii=0;
for ($i=0; $ii<$info[$i]["count"]; $ii++){
$data = $info[$i][$ii];
echo $data.": ".$info[$i][$data][0]."
";
}
ldap_close($connect);
?>
阅读(1021) | 评论(0) | 转发(0) |