ldap_search()

From: Date: Thu, 08 Mar 2001 01:12:21 +0000
Subject: ldap_search()
Groups: php.general 
Request: Send a blank email to php-general+get-42980@lists.php.net to get a copy of this message
Sorry about this, but I don't know much about LDAP, and the book I have doesn't tell me much. I was shown the following script to grab information from an LDAP server and display the results in a phonebook type format. <HTML> <BODY> <?php $ldapserver = "ldap.something.com"; $basedn = "dc=something, dc=com"; $dir =ldap_connect($ldapserver); // Connect to server if ($dir) { ldap_bind($dir); // Bind to the server $result = ldap_search($dir, $basedn, "sn=*"); // query connection, set the base and look for any sn $info = ldap_get_entries($dir, $result); // The results get sent to the $info object for ($i=0; $i<$info["count"]; $i++) { // Count is a ldap feature that contains the length of the resultset echo $info[$i]["cn"][0]; // choose any parameter you want see here } ldap_close($dir); } ?> </BODY> </HTML> The problem I am running into I think is that I work for a school district, and I don't have a .com address. I have anoka.k12.mn.us. I tried to put in $basedn = "dc=anoka, dc=k12, dc=mn, dc=us"; but I still receive an error on ldap_search. Am I doing this correctly? Mike

« previous php.general (#42980) next »