I am working on writing the code (with PHP LDAP functions) to insert
records into a directory. I have been working for about five hours
now, trying to insert a new organization, but to no avail. I continue
to get an error (65) from this block of code, and I cannot figure out
why. Any ideas?
function addOrganization(){
global $host, $user_name, $password, $ldapbase;
$ds = ldap_connect($host);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if($ds){
//bind with appropriate dn to give update access
$r = ldap_bind($ds, $user_name, $password);
$dn = 'libkey=SP-RANDAL-LIBRARY,ou=Boston,'.$ldapbase;
echo $dn.'<br />';
//build test array
$orgArray=array();
$orgArray['objectClass']=array("top", "organization",
"mlinOrganization");
$orgArray['sadacOrganizationName'] = 'Randal Rust
Library';
$orgArray['libkey'] = 'SP-RANDAL-LIBRARY';
//execute entry
$r = ldap_add($ds, $dn, $orgArray);
if(!$r){
echo 'error - '.ldap_error($ds).'<br />';
echo 'error - '.ldap_errno($ds).'<br />';
}
else {
echo 'success - organization successfully aded
to the directory.<br />';
}
}
else {
echo 'error in ds';
}
}
--
Randal Rust
R.Squared Communications
www.r2communications.com
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php