note 20803 deleted from function.ldap-get-entries by googleguy

From: Date: Tue, 22 Oct 2013 09:01:29 +0000
Subject: note 20803 deleted from function.ldap-get-entries by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196830@lists.php.net to get a copy of this message
Note Submitter: matt.s(remove)at(remove)aptalaska.net ---- I noticed the same thing Ron did, except I couldn't get php to return the attribute values using numerical pointers at all. I ended up using an eval() to pass in the associative name: $ds=ldap_connect("ldapserver"); if ($ds) { $r=ldap_bind($ds); #bind to directory $sr=ldap_search($ds,"dc=domain,dc=net", "uid=user"); #search for user print "Number of entires returned is " .ldap_count_entries($ds,$sr)."<p>"; $info = ldap_get_entries($ds, $sr); #get the result print "Data for ".$info["count"]." items returned:<p>"; for ($i=0; $i<$info["count"]; $i++) { #loop though ldap search result print "dn: " . $info[$i]["dn"] . "<br>"; #print dn for ($ii=0; $ii<$info[$i]["count"]; $ii++) { #loop though attributes in this dn print "&nbsp;&nbsp;" . $info[$i][$ii] . ": "; #print attribute name $attrib = $info[$i][$ii]; #set attribute eval("print \$info[\$i][\"$attrib\"][0];"); #print attribute value print "<br>"; } print "<br>"; } ldap_close($ds); } else { echo "<h4>Unable to connect to LDAP server</h4>"; }

« previous php.notes (#196830) next »