Example 39
// Connect to the LDAP server on localhost. Give the name "con" to the connectionldapconnect("con", "localhost", "","");// Retrieve information about the user specified in $ourref$theuser = ldapgetuser("con", "dc=streamserve,dc=com",$ourref, "", "");/* Retrieve the sn and givenname attributes of the user. Concatenate the two values with a comma in between, and store the string in $refNam.*/$refNam = ldapgetattrvalue($theuser, "sn", 0) + ", " +
ldapgetattrvalue($theuser, "givenname", 0);// Retrieve the user’s fax number and store it in $ourfax.$ourfax = ldapgetattrvalue($theuser,"facsimiletelephonenumber", 0);/* Here you either proceed with further queries or call LdapDisConnect to terminate the connection to the LDAP server.*/
Example 40 This script identifies members of a group, and queries the attributes (email address and common name) of each member.
Example 41 The following example is a variation of Example 40. This script identifies members of a group, and queries the attributes (email address) of each member. It then creates a string with concatenated email addresses for a mass mailing (an email is sent to every member of this group).
Example 42
/* Connect to the LDAP server on localhost. Give the name "con" to the connection. The username used is "Directory Manager" and password is "dmanager"*/ldapconnect("con", "localhost", "cn=Directory Manager", "dmanager");/* Find the user entry $ourref. The first argument is the connection ID, the second specifies the root of the search tree. The third argument is the common name to search for.*/$theuserlist = ldapfind("con", "dc=streamserve,dc=com", "cn=" + $ourref);// Find the first (and hopefully only) entry in the result.$theuser = ldapgetentry($theuserlist, 0);// Get the user’s fax number$ourfax = ldapgetattrvalue($theuser, "facsimiletelephonenumber", 0);// Update the e-mail addressldapreplaceattrvalue($theuser, "mail", $ourref_email);//Write the changes made to $theuser back to the LDAP server.ldapupdateentry($theuser);/* Here you either proceed with further queries or call LdapDisConnect to terminate the connection to the LDAP server.*/
OpenText StreamServe 5.6 | Updated: 2013-03-01 |