Re: ldap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I have googled abit and found some info on how to retrieve
user info from Active directory but i am getting the
following error for some reason:

Warning: ldap_search() [function.ldap-search]: Search:
Operations error in /srv/www/htdocs/ldap7.php on line 19

Warning: ldap_get_entries(): supplied argument is not a
valid ldap result resource in /srv/www/htdocs/ldap7.php on
line 21

Here is the script:

<?php

    $dn = "OU=ldap,DN=w2k,DN=domain,DN=net";

    $attributes = array("displayname", "l");

    $filter = "(cn=*)";

    $ad = ldap_connect("ldap://w2k.domain.net";)
          or die("Couldn't connect to AD!");
  
    ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);

    $bd = ldap_bind($ad,"Administrator","")
          or die("Couldn't bind to AD!");

$result = ldap_search($ad, $dn, $filter, $attributes);

    $entries = ldap_get_entries($ad, $result);

    for ($i=0; $i<$entries["count"]; $i++)
    {
        echo $entries[$i]["displayname"]
             [0]."(".$entries[$i]["l"][0].")<br />";
    }

    ldap_unbind($ad);

?>

Any help please, thanks?

Regards


On Sat, 18 Dec 2004 10:41:29 +0200
 "it clown" <php5@xxxxxxxxxxxxx> wrote:
> Hi All,
> 
> How do i retreive info with php from w2k active
> directory.
> I am running php from a linux box connecting to a windows
> 2000 domain controller.It seems asif i can connect to w2k
> but i have noidea how to retreive the list of users.How
> would i do that?
> 
> <?php
> 	$ldaphost = "ldap://w2k.domain.net";;
> 	$ldapport = "389";
> 	$ldapuser = "administrator";
> 	$ldappasswd = "";
> 	$ldaplink = ldap_connect($ldaphost, $ldapport)
> 	or die("Can't establish LDAP connection");
> 	
> ldap_bind($ldaplink, $ldapuser, $ldappasswd)
> 	or die("Can't bind to server...");
> ?>
>
_____________________________________________________________________
> For super low premiums, click here
> http://www.dialdirect.co.za/quote
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

_____________________________________________________________________
For super low premiums, click here http://www.dialdirect.co.za/quote

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux