Querying Public LDAP Servers


One of the best ways to begin using LDAP is by querying public LDAP directories. Although literally thousands of such directories exist, some of the better ones come from universities across the world. And because most of these directories allow anonymous access, you can easily query them.

Listing 22.1 queries a college in Denver called Metropolitan State College of Denver.

Listing 22.1. GetStudents.cfmQuerying Public Servers
 <!--- Query the LDAP server ---> <cfldap        server="ldap.nyu.edu"        action="QUERY"        name="getStudents"        attributes="ou,cn,mail"        start="c=us"        scope="SUBTREE"        filter="ou=Tisch School of the Arts*"        > <!--- Display the query results ---> <TABLE BORDER="0" CELLSPACING="2" CELLPADDING="2">  <TR>  <TH COLSPAN="3">  <cfoutput>  A total of #GetStudents.RecordCount# records were found.  </CFOUTPUT>  </TH>  </TR>  <TR>  <TH>Record</TH>  <TH>Name</TH>  <TH>E-Mail</TH>  <TH>Department</TH>  </TR>  <CFOUTPUT QUERY="GetStudents">  <TR>  <TD>#GetStudents.CurrentRow#</TD>  <TD>#GetStudents.cn#</td>  <TD><A HREF="mailto:#GetStudents.mail#">#GetStudents.mail#</A></TD>  <td>#GetStudents.ou#</td>  </TR>  </CFOUTPUT> </TABLE> 

In this example, we told <cfldap> to return a query called GetStudents that contains the common name (cn) Department (ou), and email (mail) attributes. Each of these attributes is represented as a column name within the query. At this point, a lot of this will not make sense, but this example is intended to show you how simple a query can be and to have you try it on your own before you continue.



Advanced Macromedia ColdFusion MX 7 Application Development
Advanced Macromedia ColdFusion MX 7 Application Development
ISBN: 0321292693
EAN: 2147483647
Year: 2006
Pages: 240
Authors: Ben Forta, et al

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net