[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: LDAP - PHP



  Hello, I'm not so sure, but your "dn" has the character "," used to
distinguish your fields in ldap_search. That's the only strange thing I see
(but I only began using php three weeks ago).

   Best regards,

On 11 de jun de 2002, a las 02:51 +0200, Informations wrote:
> 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
> 
> 

-- 
                                               Guillermo.
-----------------------------------------------------------
  ()  ascii ribbon campaign - against html mail 
  /\                        - against microsoft attachments
-----------------------------------------------------------