Your cart is currently empty!
PHP and LDAP/Active Directory
<?php
putenv('LDAPTLS_REQCERT=never');
// putenv('TLS_CACERTDIR=/path-to-cert-dir');
// putenv('TLS_CACERT=/path-to-cert-dir/ca-cert.pem');
// ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
$handle = ldap_connect('ldap.forumsys.com');
// ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
// ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$bind = ldap_bind($handle, 'uid=riemann,dc=example,dc=com', 'password');
if ($bind) {
$search = ldap_search($handle, "dc=example,dc=com", "(objectClass=*)");
$results = ldap_get_entries($handle, $search);
foreach ($results as $index => $entry) {
echo '<h1>' . $index . '</h1>';
echo '<pre>' . print_r($entry, true) . '</pre>';
echo '=======================';
}
} else {
echo 'failed to bind';
}
Leave a Reply