note 42299 rejected from ref.ldap by nlopess
| From: | nlopess@php.net | Date: | Tue, 11 May 2004 15:23:51 +0000 |
| Subject: | note 42299 rejected from ref.ldap by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-69467@lists.php.net to get a copy of this message | ||
Note Submitter: tomas.otradovec@centrum.cz
----
Please, can anybody tell me, what am I doing wrong? Our domain is prare.vs.int. I want to print any
OU or CN or anything, but this code shows only this result:
Connecting ...connect result is Resource id #2
Binding ...Bind result is 1
Searching for (sn=*) ...Search result is Resource id #3
Number of entires returned is 0
Getting entries ...
Data for 0 items returned:
Closing connection
<?php
echo "<h3>LDAP query test</h3>";
echo "Connecting ...";
$ds=ldap_connect("prareex02.prare.vs.int"); // must be a valid LDAP server!
echo "connect result is " . $ds . "<br />";
if ($ds) {
echo "Binding ...";
$r=ldap_bind($ds); // this is an "anonymous" bind, typically
// read-only access
echo "Bind result is " . $r . "<br />";
echo "Searching for (sn=*) ...";
// Search surname entry
//praredc01.prare.vs.int/OU=Uzivatele,DC=prare,DC=VS,
$sr=ldap_search($ds, "DC=PRARE,DC=VS,DC=INT", "sn=*");
echo "Search result is " . $sr . "<br />";
echo "Number of entires returned is " . ldap_count_entries($ds, $sr) . "<br
/>";
echo "Getting entries ...<p>";
$info = ldap_get_entries($ds, $sr);
echo "Data for " . $info["count"] . " items returned:<p>";
for ($i=0; $i<$info["count"]; $i++) {
echo "dn is: " . $info[$i]["dn"] . "<br />";
echo "first cn entry is: " . $info[$i]["cn"][0] . "<br
/>";
echo "first email entry is: " . $info[$i]["mail"][0] . "<br
/><hr />";
}
echo "Closing connection";
ldap_close($ds);
} else {
echo "<h4>Unable to connect to LDAP server</h4>";
}
?>