Re: Ldap question

From: Marcin Dobrucki (Marcin.Dobrucki_at_TAKETHISAWAY.nokia.com)
Date: 02/17/05


Date: Thu, 17 Feb 2005 12:30:39 GMT

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_result);
        ...
        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



Relevant Pages

  • ldap cgi or php script
    ... 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. ...
    (comp.unix.solaris)
  • Ldap question
    ... 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. ...
    (comp.unix.admin)
  • Enabling LDAP on Plesk 8
    ... Am currently running Plesk 8.0.1. ... A php script with phpinfowill give: ... As such, when running a script that uses any LDAP functions, I will get error msgs like: ...
    (php.general)
  • Re: [PHP] Verry strange GET behaviour
    ... On the topic of passing args, ... and a simple php script in a file called test.cgi ... but not while run as a cgi. ... Do you Yahoo!? ...
    (php.general)
  • Ldap Question
    ... I have openldap 2.2.10 on Redhat Linux 9. ... We are just using it as an adressbook. ... Is there already a cgi or php script to make some queries to an Ldap ...
    (linux.redhat)