I am having trouble doing an ldap_bind using secure ldap. The code works fine if I remove the "ldaps://" from the ldap_connect function. However, I need to find a way to secure the transmission of the data to the ldap server. (in this case eDirectory)
//This establishes a connection to a LDAP server on a specified hostname and port.
$ldap = @ldap_connect("ldaps://161.31.24.19") or die("Could not connect to LDAP server."); // must be a valid LDAP server!
if ($ldap)
{
//This does a bind operation on the directory
$bindString = "cn=" . $username . ",ou=" . $ou . ",o=" . $myOrganization;
$bind_results = @ldap_bind($ldap, $bindString, $password) //or die("Could not log you in please check your UserName and Password and try again.");
if($bind_results)
{
echo "Error verifying username/password";
exit;
}
else
{
echo "User authenticated";
}
}
[/QUOTE]