Re: LDAP
| From: | Daniel Brown | Date: | Tue, 21 Aug 2007 18:15:21 +0000 |
| Subject: | Re: LDAP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261086@lists.php.net to get a copy of this message | ||
On 8/21/07, Dan Shirah <mrsquash2@gmail.com> wrote:
> Okay, hopefully someone can help me out here. I've gone over ldap at
> php.net and multiple other sites but can't get it to work. Everytime I run
> the query my results are "0 entries returned".
>
> My AD tree is: CN=Users,DC=domain,DC=us. I have the AD Server set so that
> anonymous access to retrieve information is enabled.
>
> Below is my code. Any ideas?
>
>
> <?php
> $ldap_host = "AD Server";
> $ldap_port = "389";
> $base_dn = "DC=domain,DC=us";
> $filter = "(CN=users)";
> $connect = ldap_connect( $ldap_host, $ldap_port);
> ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
>
> $bind = ldap_bind($connect);
> $read = ldap_search($connect, $base_dn, $filter);
>
> $info = ldap_get_entries($connect, $read);
> echo $info["count"]." entries returned<BR><BR>";
> for($row = 0; $row<$info["count"]; $row++)
> {
> for($column = 0; $column<$info[$row]["count"]; $column++)
> {
> $data = $info[$row][$column];
> echo $data.":".$info[$row][$data][0]."<BR>";
> }
> echo "<BR>";
> }
> ldap_close($connect);
> ?>
>
This may be kind of a dumb question.... but did you check your
firewall settings?
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
Hey, PHP-General list....
50% off for life on web hosting plans $10/mo. or more at
http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07
Register domains for about $0.01 more than what it costs me at
http://domains.pilotpig.net/.