Answer the question
In order to leave comments, you need to log in
Why is php ldap returning 0 records?
tell me why with such a connection it gives 0 records, although there are records on the server
<?php
//Параметры подключения
$LDAP = array(
'server' => '217.107.193.59',
'port' => '389',
'user' => '[email protected]',
'pass' => '123$zxc',
'dn' => 'OU=epc,DC=epc,DC=local'
);
// Подключаемся к серверу
$adconn = ldap_connect($LDAP['server'], $LDAP['port'])
or die('Не могу подключиться к LDAP-серверу 1');
// Устанавливаем версию протокола
ldap_set_option($adconn, LDAP_OPT_PROTOCOL_VERSION, 3);
// Привязка
ldap_bind($adconn, $LDAP['user'], $LDAP['pass'])
or die('Не мего подключиться к LDAP серверу 11');
// выборка
$filter = "(sn=*)";
$att = array( "ou","userPrincipalName");
$result=ldap_search($adconn, $LDAP['dn'], $filter, $att);
if ($result) {
$info = ldap_get_entries($adconn, $result);
print $info["count"]." entries returned";
} else
print "LDAP search error ".ldap_errno($adconn)." (".ldap_error($adconn).")";
ldap_close($adconn);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question