[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-general
Subject:    Re: [PEAR] Trying to uset Net_LDAP.
From:       Jan Wagner <skywalker () wh2 ! tu-dresden ! de>
Date:       2004-09-29 8:40:06
Message-ID: 1096447206.2244.27.camel () skywalker ! netsols ! local
[Download RAW message or body]

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

-- 
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic