9/25/2009 – I have graduated from UTK and my personal webspace does not exist anymore. Hence, the links in [1] below do not work. The script is copy-pasted below for reference, in case you would like to try it out.
Previously, I have tried accessing the UTK LDAP server a couple of times. But I always ran into one problem or the other. Finally succeded today.
[1] PHP script to query the UTK LDAP server
Wrote a PHP script to query the UTK LDAP server. Got the basic info from the php.net website. The script is online here. The source code can be viewed here.
Source code for ldap.php
<?php
// PHP script to search UT LDAP server
// Bobby Maisnam [ bobby@maisnam.com ] 2:53 AM 5/7/2004
$ldapServer = 'ldap.utk.edu';
$ldapBase = 'dc=tennessee,dc=edu';
$attribute = $_GET["a"];
$value = $_GET["v"];
/* try to connect to the server */
$ldapConn = ldap_connect($ldapServer);
if (!$ldapConn)
{
die('Cannot Connect to LDAP server');
}
/* bind anonymously */
$ldapBind = ldap_bind($ldapConn);
if (!$ldapBind)
{
die('Cannot Bind to LDAP server');
}
/* set the ldap options */
ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3);
/* search the LDAP server */
$ldapSearch = ldap_search($ldapConn, $ldapBase, "($attribute=*$value*)");
$ldapResults = ldap_get_entries($ldapConn, $ldapSearch);
$record_count = $ldapResults['count'];
echo "<p><b>$record_count</b> records returned</p>\n";
for ($item = 0; $item < $ldapResults['count']; $item++)
{
$item2 = $item+1;
echo "<hr />\n";
echo "<h4>Displaying record [$item2]</h4>\n";
for ($attribute = 0; $attribute < $ldapResults[$item]['count']; $attribute++)
{
$data = $ldapResults[$item][$attribute];
echo $data.": ".$ldapResults[$item][$data][0]."<br>";
}
echo '<hr /><br><br>';
}
?>
[2] Setting up LDAP address book in OutlookExpress
– Open OutlookExpress
– Tools > Address Book
– In Address Book, Tools > Accounts
– Add (use the following info)
LDAP server: ldap.utk.edu
Port: 389 (default)
Search Base: ou=People,ou=Knoxville,dc=tennessee,dc=edu
Useful Links:
– http://dii.utk.edu/ldap/
– http://web.utk.edu/~mike/mac/osx-utk-ldap.html
– http://us2.php.net/manual/en/ref.ldap.php