Trying to uset Net_LDAP.
| From: | Frederic Trudeau | Date: | Tue, 28 Sep 2004 16:09:17 +0000 |
| Subject: | Trying to uset Net_LDAP. | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14666@lists.php.net to get a copy of this message | ||
Greetings list.
I am having troubles using the Net_LDAP package (still beta, as of
release 0.6.5)
I am unable to retrieve a single record from LDAP, which I know is valid.
For instance, here is a typical entry of a mailalias in our current
LDAP schema :
dn: cn=frederic.trudeau@cam.org,ou=MailAlias, dc=cam,dc=org
cn: frederic.trudeau@cam.org
maildrop: ftrudeau@zesolution.com
maildomain: cam.org
mailacceptinggeneralid: frederic.trudeau@cam.org
objectClass: MailAlias
And here is the code im using to try and grab the entry :
[CODE]
...
$options = array (
'dn' => 'cn=user,dc=cam,dc=org',
'host' => '127.0.0.1',
'password' => 'password',
'tls' => false,
);
$ldap =& Net_LDAP::connect($options);
$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 (!$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 : )
<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>
--
Frédéric Trudeau - ZeSolution Enr.
http://www.zesolution.com/