dcparham Posted January 18, 2008 Share Posted January 18, 2008 see below the code, then the OUTPUT. the output indicates no errors, yet the results appear empty. i just do not know at this point why it produces nothing. something missing?? i took out all the filters so as to trying getting any/all data via the query, to no avail. can someone help?? #################################################### <?php // basic sequence with LDAP is connect, bind, search, interpret search // result, close connection echo "<h3>LDAP query test</h3>"; echo "Connecting ..."; $ldapHost="***"; //can also use "***" $ldapPort="***"; $ldapUser = "***"; $ldapPswd = "***"; $ldapConn=ldap_connect($ldapHost, $ldapPort) or die("Can't establish LDAP connection"); // must be a valid LDAP server! //from PHP and LDAP[p356-357] in "Beginning PHP5 and MySQL[iSBN#1-893115-51-8] ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION,3); ldap_start_tls($ldapConn); echo "connect result is " . $ldapConn . "<br />"; echo "[ldap_error($ldapConn): ".ldap_error ($ldapConn)."]<BR>"; echo "[ldap_err2str (ldap_error ($ldapConn))]: ". ldap_err2str (ldap_error ($ldapConn))."<BR>"; if ($ldapConn) { echo "Binding ..."; $ldapBind=ldap_bind($ldapConn, $ldapUser, $ldapPswd) or die("Can't bind to the server."); // this is an "anonymous" bind, typically // read-only access echo "Bind result is " . $ldapBind . "<br />"; // echo "Searching for (sn=S*) ..."; original echo "Searching for (s=*) ..."; $searchResults=ldap_search($ldapConn); echo "Search result is " . $searchResults . "<br />"; echo "Number of entires returned=" . ldap_count_entries($ldapConn, $searchResults) . "<br />"; echo "Getting entries ...<p>"; $info = ldap_get_entries($ldapConn, $searchResults); 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($ldapConn); } else { echo "<h4>Unable to connect to LDAP server</h4>"; } ?> #################################################### ************ * the OUTPUT * ************ LDAP query test Connecting ...connect result is Resource id #1 [ldap_error(Resource id #1): Decoding error] [ldap_err2str (ldap_error (Resource id #1))]: Success Binding ...Bind result is 1 Searching for (s=*) ...Search result is Number of entires returned= Getting entries ... Data for items returned: Closing connection ####################################################### can someone help?? Link to comment https://forums.phpfreaks.com/topic/86687-phpldap-no-errors-but-no-results/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.