LDAP ldap_exop

(PHP 7 >= 7.2.0, PHP 8)

ldap_exop — 확장 작업을 수행합니다.


설명

ldap_exop(
    LDAP\Connection $ldap,
    string $request_oid,
    string $request_data = null,
    array $controls = null,
    string &$response_data = ?,
    string &$response_oid = ?
): mixed
                

request_oid가 작업의 OID이고 request_data가 데이터인 지정된 ldap에서 확장 작업을 수행합니다.


매개변수

ldap
ldap_connect()에 의해 반환된 LDAP\Connection 인스턴스입니다.
request_oid
확장 작업 요청 OID입니다. LDAP_EXOP_START_TLS, LDAP_EXOP_MODIFY_PASSWD, LDAP_EXOP_REFRESH, LDAP_EXOP_WHO_AM_I, LDAP_EXOP_TURN 중 하나 또는 보내려는 작업의 OID가 있는 문자열을 사용할 수 있습니다.
request_data
확장 작업 요청 데이터입니다. LDAP_EXOP_WHO_AM_I와 같은 일부 작업의 경우 NULL일 수 있으며 BER 인코딩이 필요할 수도 있습니다.
controls
요청과 함께 보낼 LDAP 컨트롤의 배열입니다.
response_data
제공된 경우 확장 작업 응답 데이터로 채워집니다. 제공하지 않으면 나중에 결과 개체에 ldap_parse_exop를 사용하여 이 데이터를 얻을 수 있습니다.
response_oid
제공되는 경우 응답 OID로 채워지며 일반적으로 요청 OID와 동일합니다.

반환 값

response_data와 함께 사용하면 성공 시 true, 오류 시 false를 반환합니다. response_data 없이 사용하면 결과 식별자를 반환하거나 오류 시 false를 반환합니다.


변경 로그

버전 설명
8.1.0 ldap 매개변수는 이제 LDAP\Connection 인스턴스를 예상합니다. 이전에는 리소스가 필요했습니다.
7.3.0 serverctrls 지원 추가됨

Examples

예제 #1 Whoami 확장 작업

                  
<?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";
}
?>
                  
                

기타