Created
September 18, 2016 07:01
-
-
Save Wintereise/4280091ae4b2c82aaaf554d8716642ec 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 | |
require_once __DIR__ .'vendor/autoload.php'; | |
$config = [ | |
// Mandatory Configuration Options | |
'domain_controllers' => [ 'a.b.c' ], | |
'base_dn' => 'ou=users,dc=b,dc=com', | |
'admin_username' => 'uid=someuser,ou=something', | |
'admin_password' => 'somepass', | |
// Optional Configuration Options | |
'account_prefix' => '', | |
'account_suffix' => '', | |
'admin_account_suffix' => '', | |
'port' => 10636, | |
'follow_referrals' => false, | |
'use_ssl' => true, | |
'use_tls' => false, | |
'timeout' => 5, | |
]; | |
$ad = new \Adldap\Adldap(); | |
$provider = new Adldap\Connections\Provider($config); | |
$ad->addProvider('default', $provider); | |
try | |
{ | |
$ad->connect('default'); | |
$results = $provider->search()->findByOrFail('mail','[email protected]'); | |
var_dump($results); | |
} | |
catch (Exception $e) | |
{ | |
echo $e->getMessage() . $e->getTraceAsString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment