Re: Trying to uset Net_LDAP.

From: Date: Wed, 29 Sep 2004 08:40:06 +0000
Subject: Re: Trying to uset Net_LDAP.
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14680@lists.php.net to get a copy of this message
Hi there, > [CODE] > ... > > $options = array ( > 'dn' => 'cn=user,dc=cam,dc=org', > 'host' => '127.0.0.1', > 'password' => 'password', > 'tls' => false, > ); > > $ldap =& Net_LDAP::connect($options); > can you do this? if (Net_LDAP::isError($ldap)) { print($ldap->getMessage()); } > $options = array ( > 'scope' => 'base', > 'attributes' => array ( > 'mailacceptinggeneralid', > 'maildrop', > 'cn', > 'maildomain', > ), > ); > > $alias = 'frederic.trudeau@cam.org'; > > $search =& $ldap->search('ou=MailAlias,dc=cam,dc=org', > "mailacceptinggeneralid=$alias", $options); if (Net_LDAP::isError($search)) { print($search->getMessage()); } > if (!$search->count()) > { > die ("no result?"); > } > > [/CODE] > > > Now i think the code above is pretty self-explanatory. > I do not see where a mistake could have been made. > Pointers would be greatly appreciated : ) As far as I can see everything looks okay here, except for the error checking. Let's see what happens there. > <rant> > > The PEAR group seams very well organised. > > However, may i suggest forcing package maintainers to add complete and > _working_ examples of their code, directly in the tarball, and/or on > the web. > > </rant> No offense taken. The project started as an implementation of perls Net::LDAP, so much documentation can be found there. The package is still beta (should be alpha I guess ;-)) and neither Tarjej or me (the maintainers) bothered to write documentation, yet. We have some fixes pending and I will see to it that we get together a new release with at least an example.php. Unfortunately Tarjej and I have much to do right now, so the upcoming 0.7 is still a bit away, which will have cleaner code. Jan

« previous php.pear.general (#14680) next »