Created
May 12, 2017 15:32
-
-
Save Gunni/0bd5095fa73c74cea84eecea7be9d3a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define(LDAP_OPT_DIAGNOSTIC_MESSAGE, 0x0032); | |
$handle = ldap_connect('ldap://9.0.0.1'); | |
$bind = ldap_bind($handle, '[email protected]', 'super good password'); | |
if ( ! $bind) | |
{ | |
if (ldap_get_option($handle, LDAP_OPT_DIAGNOSTIC_MESSAGE, $extended_error)) | |
{ | |
echo "Error Binding to LDAP: $extended_error"; | |
} | |
else | |
{ | |
echo "Error Binding to LDAP: No additional information is available."; | |
} | |
} | |
else | |
{ | |
$result = ldap_search($handle, 'DC=domain,DC=local', '(sAMAccountName=some_username)'); | |
$info = ldap_get_entries($handle, $result); | |
var_dump($info); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment