Good day everyone. I want in the form when you enter the soap, display the name and surname.

Connection and binding to AD through the ldap module is obtained through ldap_connect() and ldap_bind . But I don’t yet know how to create a request. Can I get a hint?

    1 answer 1

    Happened! Here is an example.

     $srv = "10.10.10.10"; $srv_domain = "domain.kz"; $srv_login = "artem@".$srv_domain; $srv_password = "pass"; $dn = "dc=domain, dc=kz"; $LDAPFieldsToFind = array("sn","givenname"); $SearchFor="Artem"; $SearchField="samaccountname"; $filter="($SearchField=$SearchFor*)"; $connect = ldap_connect("ldap://".$srv); ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($connect, LDAP_OPT_REFERRALS, 0); $r = ldap_bind($connect,$srv_login,$srv_password); if ($r){ $sr=ldap_search($connect, $dn, $filter, $LDAPFieldsToFind); $result_ent = ldap_get_entries($connect, $sr); print($result_ent[0]['givenname'][0].' '.$result_ent[0]['sn'][0]); } 

    source here http://php.net/manual/ru/function.ldap-search.php