[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: LDAP - PHP
Try
<pre>
print_r $info;
</pre>
in your code for debuging. It'll print out exactly what your search is
returning.
--Kervin
> With the following ldapsearch command i have good result
> ldapsearch -x -H 'ldap://localhost/' -b 'ou=company, dc=domain, dc=com'
> -D 'uid=100000, ou=company, dc=domain, dc=com' -W cn=*DUPONT*
>
> I would like to do the same thing with PHP
>
> $server = "ldap://localhost" ;
> $ds=ldap_connect($server);
> $dn = "uid=100000, ou=company, dc=domain, dc=com";
> $value = "password";
>
> $result=@ldap_bind($ds,$dn,$value);
> $dn = "ou=company, dc=domain, dc=com";
> $filtre = "(cn=*DUPONT*)";
> $sr = ldap_search($ds, $dn, $filtre);
> $info = ldap_get_entries($ds, $sr);
>
>
> for ($i=0; $i < $info["count"]; $i++) {
> print "UID: ".$info[$i]["urn"][0]."<br /><br />";
> print "telephoneNumber: ".$info[$i]["telephoneNumber"][0]."<br
> />"; print "cn: ".$info[$i]["cn"][0]."<br />";
> }
>
> ldap_close($ds);
>
> When i execute this script, i only have URN and cn Informations , i
> haven't telephoneNumber ?
>
> Thanks for your help