PHP.nl

ldap_exop

ldap_exop

Performs an extended operation

mixed **ldap_exop** LDAP\Connection $ldap string $request_oid string $request_data array $controls string $response_data string $response_oid

Performs an extended operation on the specified with the OID of the operation and the data. ldap``request_oid``request_data

ldapldap.parameter.ldap

request_oid The extended operation request OID. You may use one of , , , , , or a string with the OID of the operation you want to send. LDAP_EXOP_START_TLS``LDAP_EXOP_MODIFY_PASSWD``LDAP_EXOP_REFRESH``LDAP_EXOP_WHO_AM_I``LDAP_EXOP_TURN

request_data The extended operation request data. May be NULL for some operations like , may also need to be BER encoded. LDAP_EXOP_WHO_AM_I

controls Array of to send with the request. LDAP Controls

response_dataWill be filled with the extended operation response data if provided. If not provided you may use ldap_parse_exop on the result object later to get this data.

response_oidWill be filled with the response OID if provided, usually equal to the request OID.

When used with , returns true on success or false on error. When used without , returns a result identifier or false on error. response_data``response_data

Voorbeeld: Whoami extended operation

<?php
$ds = ldap_connect("localhost");  // assuming the LDAP server is on this host

if ($ds) {
    // bind with appropriate dn to give update access
    $bind = ldap_bind($ds, "cn=root, o=My Company, c=US", "secret");
    if (!$bind) {
      echo "Unable to bind to LDAP server";
      exit;
    }

    // Call WHOAMI EXOP
    $r = ldap_exop($ds, LDAP_EXOP_WHO_AM_I);

    // Parse the result object
    ldap_parse_exop($ds, $r, $retdata);
    // Output: string(31) "dn:cn=root, o=My Company, c=US"
    var_dump($retdata);

    // Same thing using $response_data parameter
    $success = ldap_exop($ds, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid);
    if ($success) {
      var_dump($retdata);
    }

    ldap_close($ds);
} else {
    echo "Unable to connect to LDAP server";
}
?>

ldap_parse_result``ldap_parse_exop``ldap_exop_whoami``ldap_exop_refresh``ldap_exop_passwd