note 38287 deleted from ref.com by cmb

From: Date: Sun, 30 Jun 2019 07:51:04 +0000
Subject: note 38287 deleted from ref.com by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-211421@lists.php.net to get a copy of this message
Note Submitter: kleontiv -at- combellga -dot- ru ---- I think some one wants to access to Microsoft Active Directory using ADSI with different credential by PHP. You can also do it via pure LDAP but using ADSI it is more simpler. On VB, VBS or ASP you can do like folowing (so not trivial): <% Set dso = GetObject("LDAP:") Set DsObj = dso.OpenDSObject( _ "LDAP://DC=mydomain,DC=com", _ "DOMAIN\login", _ "password", _ ADS_SECURE_AUTHENTICATION + ADS_SERVER_BIND + ADS_USE_ENCRYPTION) for each Obj in DsObj Response.Write Obj.name & " with class of: " & Obj.class & "<br>" next %> On PHP you can do like that: <?php $ADSI = new COM("LDAP:") ; $DsObj = $ADSI->OpenDsObject("LDAP://DC=mydomain,DC=com", "DOMAIN\login", "password", 515) ; while($Obj = $DsObj->Next()) { echo $Obj->name.' with class of: '.$Obj->class.'<br>' ; } ?> The access type enumeration you can use as ADS_AUTHENTICATION_ENUM.

« previous php.notes (#211421) next »