The code below has not been tested!
To accomplish this task, you will need to observe the details embedded in the process
carried out under the LDAP protocol.
Enable the extension in the php.ini file
extension=php_ldap.dll
Uncomment the line above.
<?php
// sequência conecta, vincula , pesquisa ,trata a pesquisa , resultado e fecha conexão
// tipo mysql
echo "LDAP teste";
echo "Conectando ...";
$ds=ldap_connect("ldap.php.net"); // deve ser um servidor LDAP valido
echo "Resultado da conexão : " . $ds . "<br/>";
if ($ds) {
echo "Vinculando ...";
$r=ldap_bind($ds);
echo "Resultado: " . $r . "<br/>";
echo "Procurando por (campusid=000000137118) ...";
$sr=ldap_search($ds, "ou=University of California Irvine,o=University of California, c=US", "campusid=000000137118");
echo "Resultado da pesquisa" . $sr . "<br/>";
echo "Número de entradas" . ldap_count_entries($ds, $sr) . "<br/>";
echo "Pega as entradas...<p>";
$info = ldap_get_entries($ds, $sr);
echo "Dados " . $info["count"] . "retornados:<p>";
for ($i=0; $i<$info["count"]; $i++) {
echo "dn: " . $info[$i]["dn"] . "<br/>";
echo "Primeira cn: " . $info[$i]["cn"][0] . "<br/>";
echo "Primeiro tipo: " . $info[$i]["type"][0] . "<br/><hr/>";
}
echo "Fecha a conexão";
ldap_close($ds);
} else {
echo "Pi,pi, pi, piiiiiiiiiiiiiiii";
}
?>
Then with the obtained data, assemble a function to take the data and display.
Any difficulty put in the comment, for us to adjust.
Resources and references:
code above /
Microsoft LDAP /
PHP LDAP