1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
function ldap_extract($dn,$filtre)
{
$server = "ldap.melanie2.i2";
$port = 389;
$ds=ldap_connect($server,$port);
$r=ldap_bind($ds,"","");
$restriction=array("sn","givenname", "mail", "departmentnumber","description");
$sr=ldap_search($ds, $dn, $filtre, $restriction);
$info = ldap_get_entries($ds, $sr);
echo "Le nombre d'entrées retourné est de ".ldap_count_entries($ds,$sr)."<br>";
ldap_close ($ds);
For($i=0;$i<sizeof($info);$i++)
{
echo $info[$i]["sn"][0]." ".$info[$i]["givenname"][0]." ".$info[$i]["mail"][0]." ".$info[$i]["departmentnumber"][0]." ".$info[$i]["description"][0]."<br>";
}
}
ldap_extract("ou=DREAL Alsace,ou=DR,ou=melanie,ou=organisation,dc=equipement,dc=gouv,dc=fr","(mineqTypeEntree=BALI)"); |
Partager