note 42299 added to ref.ldap

From: Date: Tue, 11 May 2004 13:06:39 +0000
Subject: note 42299 added to ref.ldap
Groups: php.notes 
Request: Send a blank email to php-notes+get-69451@lists.php.net to get a copy of this message
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>"; } ?> ---- Manual Page -- http://www.php.net/manual/en/ref.ldap.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42299 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42299&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42299&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69451) next »