PHP code example of alaneor / ldap
1. Go to this page and download the library: Download alaneor/ldap library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
alaneor / ldap example snippets
// Include Composer's autoloader
nk = new Ldap\Ldap( 'example.com', 389 );
// Authenticate the connection with the Admin account
$link->bind( 'CN=Admin,DC=example,DC=com', 'MySecretPwd!' );
// List the items that are in the baseDN
$response = $link->ldap_list( 'DC=example,DC=com', 'objectclass=*', ['name', 'objectclass'] );
// Take a look at the structure of the Ldap\Response instance
print_r( $response );