Unix administration - Ldap question

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > February 2005 > Ldap question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Ldap question
Administrateur de systemes

2005-02-16, 5:57 pm

I have openldap 2.2.10 on solaris 9 Generic_117171-07 .
We are just using it as an adressbook .

Is there already a cgi or php script to make some queries to an Ldap
server to get phone number or email adress trough the web interface . No
add/modify is needed .


Thanks a lot
Franck
Marcin Dobrucki

2005-02-17, 7:52 am

Administrateur de systemes wrote:
> I have openldap 2.2.10 on solaris 9 Generic_117171-07 .
> We are just using it as an adressbook .
>
> Is there already a cgi or php script to make some queries to an Ldap
> server to get phone number or email adress trough the web interface . No
> add/modify is needed.


Well, it really depends on your schema, but something like this:

....
$ldap = @ldap_connect("ldap://ldap.yoursite.com");
if (!ldap_bind($ldap)) {
print "LDAP bind failed: " . ldap_error($ldap);
return false;
}
else {
$ldap_search_result =
ldap_search($ldap,$your_ldap_base,"something to search for");
$ldap_entries = ldap_get_entries($ldap,$ldap_search_resu
lt);
...
ldap_close($ldap);
}
....

And your $ldap_entries should now contain whatever the search returned
(as an associative array).

You, ofcourse, need to make sure your php is compiled with LDAP
support enabled.

/Marcin
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com