Zend_Ldap

The Zend_LDAP module by itself DOES NOT have the ability to do a search and retrieve of data items. This functionality is accomplished by the Zend_Ldap_Ext extension.

You will need to download the three files below(they are still in the test stage, but I tried them and they work as expected)

  1. Ext.php
  2. Helper.php
  3. QueryResult.php

and save them in your Zend/Ldap directory. The directory structure should look like:

image

Using the framework is quite simple. Here’s how I connect to my ldap server at UF:

$options = array (
‘server1’=> array (
‘host’=>’dir.ufl.edu’,
‘bindRequiresDn’ => true,
‘baseDn’=>’ou=People, dc=ufl, dc=edu’,
‘accountDomainName’=>’ufl.edu’,
‘username’=>‘myadminusernamehere’,
‘password’=>‘myadminpasswordhere’
)
);

$ldap = new Zend_Ldap_Ext($options[‘server1’]);
$ldap->bind(); //NOTE: THIS IS REQUIRED
$filter="(uid=nshankar)";
$objects=$ldap->searchEntries($filter);

//now, dump all the information relating to the search
print_r($objects);

NOTE

If you receive the error "Call to undefined function mb_strtolower()", either you are using an older version of PHP(<4.2) or have not enabled the MultiByte extensions in your php.ini. The function mb_strtolower() requires ‘MultiByte’ extensions.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s