note 105620 added to function.ldap-bind

From: Date: Thu, 01 Sep 2011 11:46:17 +0000
Subject: note 105620 added to function.ldap-bind
Groups: php.notes 
Request: Send a blank email to php-notes+get-182878@lists.php.net to get a copy of this message
After a lot of trail and error i've found the way to authenticate to apple's Opendirectory (snow leopard server) and thought it maybe useful to share. <?php // using ldap bind $ldaprdn = 'uid=USERNAME,cn=users,dc=HOSTNAME,dc=DOMAIN,dc=com'; // ldap rdn or dn $ldappass = 'PASSWORD'; // associated password // connect to ldap server $ldapconn = ldap_connect("HOSTNAME.DOMAIN.com") or die("Could not connect to LDAP server."); // Set some ldap options for talking to ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0); if ($ldapconn) { // binding to ldap server $ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { echo "LDAP bind successful...\n"; } else { echo "LDAP bind failed...\n"; } } ?> ---- Server IP: 83.137.20.135 Probable Submitter: 82.94.206.18 ---- Manual Page -- http://www.php.net/manual/en/function.ldap-bind.php Edit -- https://master.php.net/note/edit/105620 Del: integrated -- https://master.php.net/note/delete/105620/integrated Del: useless -- https://master.php.net/note/delete/105620/useless Del: bad code -- https://master.php.net/note/delete/105620/bad+code Del: spam -- https://master.php.net/note/delete/105620/spam Del: non-english -- https://master.php.net/note/delete/105620/non-english Del: in docs -- https://master.php.net/note/delete/105620/in+docs Del: other reasons-- https://master.php.net/note/delete/105620 Reject -- https://master.php.net/note/reject/105620 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182878) next »