ldap_get_values_len

(PHP 3 >= 3.0.13, PHP 4, PHP 5)

ldap_get_values_len -- Get all binary values from a result entry

Description

array ldap_get_values_len ( resource link_identifier, resource result_entry_identifier, string attribute )

Returns an array of values for the attribute on success and FALSE on error.

ldap_get_values_len() function is used to read all the values of the attribute in the entry in the result. entry is specified by the result_entry_identifier. The number of values can be found by indexing "count" in the resultant array. Individual values are accessed by integer index in the array. The first index is 0.

This function is used exactly like ldap_get_values() except that it handles binary data and not string data.

注: This function was added in 4.0.


add a note add a note User Contributed Notes
rcrow at NOSPAM dot laptv dot com
30-Apr-2004 08:06
If you are trying to access BINARY DATA, such as ObjectSID within LDAP, you must first get an individual entry, as stated under ldap_get_values() function -- "This call needs a result_entry_identifier, so needs to be preceded by one of the ldap search calls and one of the calls to get an individual entry."

The following code snippet will get the LDAP objectSID for a specific user.

<?php
/* Get the binary objectsid entry                                          */
/* Be sure that you have included the binary field in your ldap_search.    */
$criteria "samaccountname=$ldapUser";
$justthese = array("memberOf", "objectsid");
  
$ldapSearchResult = ldap_search($ldapConnectionResult, $ldapBase, $criteria, $justthese);
 
if (
ldap_count_entries($ldapConnectionResult, $ldapSearchResult)){
    
$ldapResults = ldap_get_entries($ldapConnectionResult, $ldapSearchResult);

  
$entry = ldap_first_entry($ldapConnectionResult, $ldapSearchResult);
  
$ldapBinary = ldap_get_values_len ($ldapConnectionResult, $entry, "objectsid");

/* your code here */
 
}
?>

You then can use something like bin2hex to put the data in a more usable form.